| You are here: DEVPPL ‹ Forum ‹ Programming ‹ CSS Forum |
NOTIFICATIONS
|
|
|||||||||||||||
Login |
Hover effects on horizontal dropdown css menu (small proble
2 posts
• Page 1 of 1
0
Hover effects on horizontal dropdown css menu (small proble
Hello, everyone!
I'm trying to do a horizontal dropdown menu on css.
As of now, i've managed to style a list of 6 unordered elements, two of them containing an unordered list of their own into blocks of 150px width.
The background color for the non-hover blocks is blue, and the font color inside is white. If you hover over a block, its background color changes to white and the font color to a light grey.
The thing is every block works fine on its own, but when i hover over one of the blocks which has an unordered list inside and then hover to one of the items inside, the original block keeps its white hover background color but its font changes back to white (i'd like it to keep its grey value).
Am i missing something in the "ul li li ul:hover ul..." semantic labyrinth?
Thank you in advance, guys.
This is the html and css code i'm using (if anyone needs it):
_________________________________________
CSS
@charset "UTF-8";
#navMenu {
width: 900px;
margin: 0 auto 0 auto;
padding: 0;
border-bottom:1px #000;
}
#navMenu ul {
margin: 0;
padding: 0;
line-height:30px;
}
#navMenu li {
margin: 0;
padding: 0;
list-style:none;
float:left;
position:relative;
background-color:#89bce6;
}
#navMenu ul li a {
text-align:center;
text-decoration:none;
height:30px;
width:150px;
display:block;
color:#fff;
}
#navMenu ul ul {
position:absolute;
visibility:hidden;
top:30px; /*cambiar a 32 si hay borde */
}
#navMenu ul li:hover ul {
visibility:visible;
}
#navMenu li:hover {
background-color: #FFF;
}
#navMenu a:hover {
color: #CCC;
}
/************************************************************/
.clearFloat {
clear:both;
margin:0px;
padding:0px;
}
_________________________________
HTML
<div id="navMenu">
<ul>
<li><a href="#">La Clínica</a></li>
<li><a href="#">Equipo</a>
<ul>
<li><a href="#">Doctores</a></li>
<li><a href="#">Higienistas</a></li>
<li><a href="#">Material Técnico</a></li>
</ul>
</li>
<li><a href="#">Servicios</a>
<ul>
<li><a href="#">Ortodoncia</a></li>
<li><a href="#">Odontología</a></li>
<li><a href="#">Implantología</a></li>
<li><a href="#">Prótesis</a></li>
<li><a href="#">Cirugía</a> </li>
<li><a href="#">Periodoncia</a></li>
<li><a href="#">Blanqueamiento</a></li>
<li><a href="#">Estética dental</a></li>
</ul>
</li>
<li><a href="#">Consejos</a></li>
<li><a href="#">Casos Clínicos</a></li>
<li><a href="#">Programa de Estancias</a></li>
</ul> <!-- end Main ul -->
<br class=".clearFloat" />
</div> <!-- end navMenu div -->
I'm trying to do a horizontal dropdown menu on css.
As of now, i've managed to style a list of 6 unordered elements, two of them containing an unordered list of their own into blocks of 150px width.
The background color for the non-hover blocks is blue, and the font color inside is white. If you hover over a block, its background color changes to white and the font color to a light grey.
The thing is every block works fine on its own, but when i hover over one of the blocks which has an unordered list inside and then hover to one of the items inside, the original block keeps its white hover background color but its font changes back to white (i'd like it to keep its grey value).
Am i missing something in the "ul li li ul:hover ul..." semantic labyrinth?
Thank you in advance, guys.
This is the html and css code i'm using (if anyone needs it):
_________________________________________
CSS
@charset "UTF-8";
#navMenu {
width: 900px;
margin: 0 auto 0 auto;
padding: 0;
border-bottom:1px #000;
}
#navMenu ul {
margin: 0;
padding: 0;
line-height:30px;
}
#navMenu li {
margin: 0;
padding: 0;
list-style:none;
float:left;
position:relative;
background-color:#89bce6;
}
#navMenu ul li a {
text-align:center;
text-decoration:none;
height:30px;
width:150px;
display:block;
color:#fff;
}
#navMenu ul ul {
position:absolute;
visibility:hidden;
top:30px; /*cambiar a 32 si hay borde */
}
#navMenu ul li:hover ul {
visibility:visible;
}
#navMenu li:hover {
background-color: #FFF;
}
#navMenu a:hover {
color: #CCC;
}
/************************************************************/
.clearFloat {
clear:both;
margin:0px;
padding:0px;
}
_________________________________
HTML
<div id="navMenu">
<ul>
<li><a href="#">La Clínica</a></li>
<li><a href="#">Equipo</a>
<ul>
<li><a href="#">Doctores</a></li>
<li><a href="#">Higienistas</a></li>
<li><a href="#">Material Técnico</a></li>
</ul>
</li>
<li><a href="#">Servicios</a>
<ul>
<li><a href="#">Ortodoncia</a></li>
<li><a href="#">Odontología</a></li>
<li><a href="#">Implantología</a></li>
<li><a href="#">Prótesis</a></li>
<li><a href="#">Cirugía</a> </li>
<li><a href="#">Periodoncia</a></li>
<li><a href="#">Blanqueamiento</a></li>
<li><a href="#">Estética dental</a></li>
</ul>
</li>
<li><a href="#">Consejos</a></li>
<li><a href="#">Casos Clínicos</a></li>
<li><a href="#">Programa de Estancias</a></li>
</ul> <!-- end Main ul -->
<br class=".clearFloat" />
</div> <!-- end navMenu div -->
- Gorkamolero
- Reputation: 0
- Posts: 2
- Joined: Wed Mar 02, 2011 3:18 pm
- Highscores: 0
- Arcade winning challenges: 0
Hover effects on horizontal dropdown css menu (small proble - Sponsored results
- Sponsored results
0
Re: Hover effects on horizontal dropdown css menu (small proble
- Code: Select all
#navMenu {
width: 900px;
margin: 0 auto 0 auto;
padding: 0;
border-bottom:1px #000;
}
#navMenu ul {
margin: 0;
padding: 0;
line-height:30px;
}
#navMenu li {
margin: 0;
padding: 0;
list-style:none;
float:left;
position:relative;
background-color:#89bce6;
}
#navMenu ul li a {
text-align:center;
text-decoration:none;
height:30px;
width:150px;
display:block;
color:#fff;
}
#navMenu ul ul {
position:absolute;
visibility:hidden;
top:30px; /*cambiar a 32 si hay borde */
}
#navMenu ul li:hover ul {
visibility:visible;
}
#navMenu li:hover {
background-color: #FFF;
color : #CCC;
}
#navMenu a:hover {
color: #CCC;
}
#navMenu li:hover a {
color : #CCC;
}
- Rajmv
- Reputation: 0
- Posts: 103
- Joined: Thu Jul 14, 2011 8:22 am
- Highscores: 0
- Arcade winning challenges: 0
|
|