我有这段代码:
#banner {-webkit-border-top-left-radius: 100px; -webkit-border-top-right-radius: 100px; -moz-border-radius-topleft: 100px; -moz-border-radius-topright: 100px; border-top-left-radius: 100px; border-top-right-radius: 100px; position:relative;}
#submenu { color: #fff; margin: 0 2%; position: relative; bottom: -0px; text-align: center; font-family: Oswald; font-weight: 700; font-size: 15px; padding:3px; z-index:1; visibility:hidden; opacity:0; -webkit-transition:300ms; -moz-transition:300ms; -o-transition:300ms; transition:300ms; }
#banner:hover #submenu { visibility:visible; opacity:1; }
当我将#banner
ID悬停时,#submenu
不会显示。我有什么不对的吗?
感谢您的帮助。
编辑:如果需要,请输入HTML代码:
<div id="banner"><div id="submenu">foo</div></div>
答案 0 :(得分:0)
检查一下:http://jsfiddle.net/4mcz0axk/ Div显示但颜色的文本是白色的,因此可能不可见。 在小提琴共享中,我故意将其改为黑色,并且工作得很好。
#banner {
-webkit-border-top-left-radius: 100px;
-webkit-border-top-right-radius: 100px;
-moz-border-radius-topleft: 100px;
-moz-border-radius-topright: 100px;
border-top-left-radius: 100px;
border-top-right-radius: 100px;
position: relative;
}
#submenu {
color: black;
margin: 0 2%;
position: relative;
bottom: -0px;
text-align: center;
font-family: Oswald;
font-weight: 700;
font-size: 15px;
padding: 3px;
z-index: 1;
visibility: hidden;
opacity: 0;
-webkit-transition: 300ms;
-moz-transition: 300ms;
-o-transition: 300ms;
transition: 300ms;
}
#banner:hover #submenu {
visibility: visible;
opacity: 1;
}