html - 将鼠标悬停在 DIV 上时显示内容

标签 html css stylesheet mousehover

悬停在 DIV 上时是否可以显示内容。参见 Image

当我将鼠标悬停在 div 上时,会发生转换,但是否可以在悬停的 div 内显示内容,即。图片等

html:

<div class="flowingdown">

</div>

CSS3:

.flowingdown {
    width:1045px;
    background-image:url(images/vertical_cloth.png);
    height:50px;
    float:left;
    margin-top:2px;
    margin-bottom:2px;
    border-radius:0 0  55px 55px ;
    transition: height 1s;
    -webkit-transition: height 1s;


}

.flowingdown:hover {
    height:100px;
}

最佳答案

假设您有以下标记:

<div id="parent">
    Some content
    <div id="hover-content">
        Only show this when hovering parent
    </div>
</div>

CSS:

#hover-content {
    display:none;
}
#parent:hover #hover-content {
    display:block;
}

这应该可以解决问题。

不确定如何处理过渡,但至少必须放置相同的选择器。

Example

关于html - 将鼠标悬停在 DIV 上时显示内容,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17858928/

相关文章:

html - Outlook 2007 到 2013 显示设备媒体查询

css - 嵌套一个位置:absolute element inside a position:fixed one

jquery - css 背景填充重复之间的间隙

safari - 涂黑内容,使一页 div 可见

html - Three20显示本地html文件

javascript - Javascript中元素样式改变的回调

html - 页面与宽背景图像对齐

css - 以编程方式添加样式表 ASP.NET (VB)

css - 当通过 jQuery slideToggle 扩展相邻的 div 时,div 不移动

javascript - HTML/TS : textarea textContent disappears after creating another textarea or after button click