Reputation: 21
Ok. So I have started to build a website, and I have tried to build a dropdown menu using css and html. The hover function for the submenu works. My only issue is, when you mouse over the menu to get to the submenu, I can't figure out how to change the font to black so it is visible.Here is a page where I am testing the code: http://mcbtaytest.zymichost.com/
Here is my code:
CSS:
body {margin:0;
padding:0;
background:#000000
}
.image{
border: none;
border:0px;
margin:0px;
padding:0px;
z-index: -1;
}
.menu{
border:none;
border:0px;
margin:0px;
padding:0px;
font: 67.5% "Lucida Sans Unicode", "Bitstream Vera Sans", "Trebuchet Unicode MS", "Lucida Grande", Verdana, Helvetica, sans-serif;
font-size:14px;
font-weight:bold;
z-index:2;
}
.menu ul{
background:#FFFFFF;
height:50px;
list-style:none;
margin:0;
padding:0;
-webkit-border-radius: 15px;
-moz-border-radius: 15px;
border-radius: 15px;
-webkit-box-shadow: inset 0px 16px 0px 0px rgba(255, 255, 255, .1);
-moz-box-shadow: inset 0px 16px 0px 0px rgba(255, 255, 255, .1);
box-shadow: inset 0px 16px 0px 0px rgba(255, 255, 255, .1);
}
.menu li{
float:left;
padding:0px 0px 0px 15px;
}
.menu li a{
color:#000000;
display:block;
font-weight:normal;
line-height:50px;
margin:0px;
padding:0px 25px;
text-align:center;
text-decoration:none;
}
.menu li a:hover{
background:#000000;
color:#FFFFFF;
text-decoration:none;
-webkit-box-shadow: inset 0px 0px 7px 2px rgba(0, 0, 0, .3);
-moz-box-shadow: inset 0px 0px 7px 2px rgba(0, 0, 0, .3);
box-shadow: inset 0px 0px 7px 2px rgba(0, 0, 0, .3);
}
.menu ul li:hover a{
background:#000000;
color:#FFFFFF;
text-decoration:none;
}
.menu li ul{
display:none;
height:auto;
padding:0px;
margin:0px;
border:0px;
position:absolute;
width:200px;
z-index:200;
}
.menu li:hover ul{
display:block;
}
.menu li li {
display:block;
float:none;
margin:0px;
padding:0px;
width:200px;
background:#FFFFFF;
/*this is where the rounded corners for the dropdown disappears*/
}
.menu li:hover li a{
background:none;
}
.menu li ul a{
display:block;
height:50px;
font-size:12px;
font-style:normal;
margin:0px;
padding:0px 10px 0px 15px;
text-align:left;
}
.menu li ul a:hover, .menu li ul li:hover a{
border:0px;
color:#ffffff;
text-decoration:none;
background:#000000;
-webkit-box-shadow: inset 0px 0px 7px 2px rgba(0, 0, 0, .3);
-moz-box-shadow: inset 0px 0px 7px 2px rgba(0, 0, 0, .3);
box-shadow: inset 0px 0px 7px 2px rgba(0, 0, 0, .3);
}
HTML:
<div class="image">
<img src="/Resources/img/Header.png" width=100% style={margin:0;padding:0;}/></img>
</div>
<div class="menu">
<ul>
<li><a href="#" >Home</a></li>
<li>
<a href="#" id="current">About</a>
<ul>
<li><a href="#">Company Info</a></li>
</ul>
</div>
I for some reason can't figure out how to solve this.
Upvotes: 1
Views: 755
Reputation: 71
add color:#000
on .menu li:hover li a
:
.menu li:hover li a{
background:none;
color:#000;
}
Upvotes: 0
Reputation: 3645
I made some changes to your html (it was broken, and some elements where redundant), and your css (removed some selectors and rewrote others).
Is this something like what you were going for?
Upvotes: 1
Reputation: 9469
Edited:
Change the following line
.menu ul li:hover a
with this line;
.menu ul li:hover > a
It is more specific now.
Upvotes: 1