I have some issues with my horizontal menu. The main content should avoid the sub menu. So when the sub menu opens it should shove the main content down.
The html
<ul id="menu">
<li class="active">Menu1</li>
<li class="active">Menu2
<ul>
<li class="active">Sub 1</li>
<li class="active">Sub 2</li>
<li class="active">Sub 3</li>
<li class="active">Sub 4</li>
</ul>
</li>
and the css
#menu{
width: 100%;
margin-left:auto;
margin-right:auto;
padding: 15px 0 0 0;
list-style: none;
background: #111;
background: -moz-linear-gradient(#444, #111);
background: -webkit-gradient(linear,left bottom,left top,color-stop(0, #111),color-stop(1, #444));
background: -webkit-linear-gradient(#444, #111);
background: -o-linear-gradient(#444, #111);
background: -ms-linear-gradient(#444, #111);
background: linear-gradient(#444, #111);
-moz-border-radius: 3px;
border-radius: 3px;
-moz-box-shadow: 0 2px 1px #9c9c9c;
-webkit-box-shadow: 0 2px 1px #9c9c9c;
box-shadow: 0 2px 1px #9c9c9c;
min-width: 1100px;
position: relative;
clear: both;
text-align:center;
}
#menu li{
display: inline-block;
padding: 0 0 10px 0;
}
#menu a{
float: left;
padding: 0px 50px 0 0;
color: #999;
text-transform: uppercase;
font: bold 12px/25px Arial, Helvetica;
text-decoration: none;
text-shadow: 0 1px 0 #000;
height: 30px;
}
#menu li:hover > a{
color: #fafafa;
}
*html #menu li a:hover{ /* IE6 */
color: #fafafa;
}
#menu li:hover > ul {
display: block;
}
/* Sub-menu */
#menu ul{
width: 100%;
margin: 0px 0 0 0;
padding: 15px 0 0 0;
list-style: none;
display: none;
position: absolute;
top: 55px;
left: 0px;
background: #111;
background: -moz-linear-gradient(#444, #111);
background: -webkit-gradient(linear,left bottom,left top,color-stop(0, #111),color-stop(1, #444));
background: -webkit-linear-gradient(#444, #111);
background: -o-linear-gradient(#444, #111);
background: -ms-linear-gradient(#444, #111);
background: linear-gradient(#444, #111);
-moz-border-radius: 3px;
border-radius: 3px;
-moz-box-shadow: 0 2px 1px #9c9c9c;
-webkit-box-shadow: 0 2px 1px #9c9c9c;
box-shadow: 0 2px 1px #9c9c9c;
min-width: 1100px;
}
}
#menu ul li{
float: left;
padding: 0 0 10px 0;
position: relative;
}
#menu ul a{
float: left;
height: 30px;
padding: 0px 25px;
color: #999;
text-transform: uppercase;
font: bold 12px/25px Arial, Helvetica;
text-decoration: none;
text-shadow: 0 1px 0 #000;
}
#menu ul a:hover{
background: #0186ba;
background: -moz-linear-gradient(#04acec, #0186ba);
background: -webkit-gradient(linear, left top, left bottom, from(#04acec), to(#0186ba));
background: -webkit-linear-gradient(#04acec, #0186ba);
background: -o-linear-gradient(#04acec, #0186ba);
background: -ms-linear-gradient(#04acec, #0186ba);
background: linear-gradient(#04acec, #0186ba);
}
/* Clear floated elements */
#menu:after{
visibility: hidden;
display: block;
font-size: 0;
content: " ";
clear: both;
height: 0;
}
* html #menu { zoom: 1; } /* IE6 */
*:first-child+html #menu { zoom: 1; } /* IE7 */
I tried to change the #menu ul position to relative. But that messes up the whole style.
Anybody who likes to help me? =)
JSFIDDLE: http://jsfiddle.net/M8S3T/
The elements that are absolutely or fixed positioned are removed from the normal flow of the page. You must avoid position:absolute if you want to preserve the flow.
I try to make a quick example to show: http://jsfiddle.net/M8S3T/1/
#menu li{
float:left;
padding: 0 0 10px 0;
width:5em;
}
/* Sub-menu */
#menu ul{
width: 100%;
margin: 40px -80px 0;
padding: 15px 0 0 0;
list-style: none;
display: none;
background: #111;
background: -moz-linear-gradient(#444, #111);
background: -webkit-gradient(linear,left bottom,left top,color-stop(0, #111),color-stop(1, #444));
background: -webkit-linear-gradient(#444, #111);
background: -o-linear-gradient(#444, #111);
background: -ms-linear-gradient(#444, #111);
background: linear-gradient(#444, #111);
-moz-border-radius: 3px;
border-radius: 3px;
-moz-box-shadow: 0 2px 1px #9c9c9c;
-webkit-box-shadow: 0 2px 1px #9c9c9c;
box-shadow: 0 2px 1px #9c9c9c;
min-width: 1100px;
}
#menu li ul li {
float:left;
padding: 0 0 10px 0;
width: 10em;
}
#menu ul a{
float: none;
height: 30px;
padding: 0px 25px;
color: #999;
text-transform: uppercase;
font: bold 12px/25px Arial, Helvetica;
text-decoration: none;
text-shadow: 0 1px 0 #000;
}
I only post you the parts I have changed. With this you can play with the float, and if you use a fixed width for the list items it will work.
Related
I'm creating a submenu for my website but it needs some little fixes.
First, I can't make the z-index work, is displayed under the content div, in the live example I removed all z-index, and righ now, I really have no idea how this works :(
Second, in the submenu from second option, the box is more large than the first one. I'm trying to fix it but I don't see where the problem is.
/* Sub-menu */
#main-nav ul {
list-style: none;
margin: 0;
padding: 0;
display: none;
position: absolute;
/* rounded corner */
-webkit-border-radius: 8px;
-moz-border-radius: 8px;
border-radius: 8px;
}
#main-nav ul li {
float: none;
display: block;
/* box shadow */
-webkit-box-shadow: inset 0 1px 0 rgba(255, 255, 255, .3), 0 1px 1px rgba(0, 0, 0, .4);
-moz-box-shadow: inset 0 1px 0 rgba(255, 255, 255, .3), 0 1px 1px rgba(0, 0, 0, .4);
box-shadow: inset 0 1px 0 rgba(255, 255, 255, .3), 0 1px 1px rgba(0, 0, 0, .4);
/* rounded corner */
-webkit-border-radius: 8px;
-moz-border-radius: 8px;
border-radius: 8px;
}
#main-nav ul li:last-child {
box-shadow: none;
}
#main-nav ul a {
color: #fff;
background: #474747;
display: block;
white-space: nowrap;
}
#main-nav ul a:hover {
/* gradient */
background: #6a6a6a url(images/nav-bar-bg.png) repeat-x;
background: -webkit-gradient(linear, left top, left bottom, from(#b9b9b9), to(#6a6a6a));
background: -moz-linear-gradient(top, #b9b9b9, #6a6a6a);
background: linear-gradient(-90deg, #b9b9b9, #6a6a6a);
background-image: linear-gradient(-90deg, #cdcdcd, #797979);
}
#main-nav ul li:first-child a {
/* rounded corner */
-webkit-border-radius: 8px 8px 0 0;
-moz-border-radius: 8px 8px 0 0;
border-radius: 8px 8px 0 0;
}
#main-nav ul li:last-child a {
/* rounded corner */
-webkit-border-radius: 0 0 8px 8px;
-moz-border-radius: 0 0 8px 8px;
border-radius: 0 0 8px 8px;
}
#main-nav ul li:first-child a:after {
content:'';
position: absolute;
left: 30px;
top: -8px;
border-left: 8px solid transparent;
border-right: 8px solid transparent;
border-bottom: 8px solid #444;
}
#menu ul li:first-child a:hover:after {
border-bottom-color: #fafafa;
}
#main-nav:after {
visibility: hidden;
display: block;
font-size: 0;
content:" ";
clear: both;
height: 0;
}
Here's a live example: http://jsfiddle.net/y59kjsLn/1/
Thanks in advance!
Edit: add more css
.clearfix:after {
visibility: hidden;
display: block;
font-size: 0;
content: " ";
clear: both;
height: 0;
}
.clearfix { display: inline-block; }
.clearfix { display: block; zoom: 1; }
Chan this cause the z-index problem?
Edit2: Add the html code
Hmmm maybe has something to do with...
<div id="content">
<article class="post clearfix">
<?php
if(array_key_exists($matches[1], $includes)) {
$content = include($includes[$matches[1]]);
} else header("Location: /home");
?>
</article>
</div>
This is just behind the menu.
#content CSS code:
#content {
opacity: 0.8;
background: #fff;
margin: 30px 0 30px;
padding: 20px 35px;
width: 600px;
float: left;
/* rounded corner */
-webkit-border-radius: 8px;
-moz-border-radius: 8px;
border-radius: 8px;
/* box shadow */
-webkit-box-shadow: 0 1px 3px rgba(0,0,0,.4);
-moz-box-shadow: 0 1px 3px rgba(0,0,0,.4);
box-shadow: 0 1px 3px rgba(0,0,0,.4);
}
#content .error {
color: red;
text-align: center;
}
#content .note {
font-size: 80%;
text-align: center;
}
#content p {
margin-top: 30px;
}
h2.post-title {
margin-top: 15px;
background: #888;
border-radius: 5px;
padding: 0px 5px ;
border-top: 1px solid #889;
border-bottom: 1px solid #889;
text-align: center;
}
h2.post-title a {
color: #FFFFFF;
font-size: 0.9em;
text-shadow: 1px 1px 2px #333333;
}
.post {
margin-bottom: 20px;
}
.post-title {
margin: 0 0 5px;
padding: 0;
font: bold 26px/120% Arial, Helvetica, sans-serif;
}
.post-title a {
text-decoration: none;
color: #000;
}
.post-meta {
margin: 0 0 10px;
font-size: 90%;
}
figure.post-imagen img {
float: left;
margin: 5px;
max-width: 260px;
}
.clearfix:after {
visibility: hidden;
display: block;
font-size: 0;
content: " ";
clear: both;
height: 0;
}
.clearfix { display: inline-block; }
.clearfix { display: block; zoom: 1; }
Js Fiddle
removed the margin which was affecting the sub menu
#main-nav li:first-child {
margin-left: 10px;
}
edit
Remove and Add
#content
opacity: 0.8; /* removed */
background: rgba(255, 255, 255, 0.55); /* added */
}
Current my mouse pointer if there is point out of the red colour box it still doing the hover function, but what i need is i only need the hover in red colour box, it out of the box it will hide the menu.
This is the my source from JSfiddle http://jsfiddle.net/KECN7/
This is my html source code
<ul id="menu">
<li>
<ul>
<li>Logout</li>
<li>Account Settings</li>
<li>Terms & Policies</li>
</ul>
</li>
</ul>
this is css source code
#menu{
/*width: 50%;*/
margin: 0;
padding: 10px 0 0 0;
list-style: none;
position: absolute;
}
#menu li{
float: left;
padding: 0 0 10px 0;
position: relative;
}
#menu a{
float: left;
height: 25px;
padding: 0 25px;
color: #999;
text-transform: uppercase;
font: bold 12px/25px Arial, Helvetica;
text-decoration: none;
text-shadow: 0 1px 0 #000;
}
#menu li:hover > a{
color: #fafafa;
}
*html #menu li a:hover{ /* IE6 */
color: #fafafa;
}
#menu li:hover > ul{
display: block;
z-index: 99;
}
/* Sub-menu */
#menu ul{
list-style: none;
margin: 10px 0 25px 0;
/*width: 50px;*/
padding: 0;
display: none;
position: absolute;
top: 20px;
right: 10px;
z-index: 99999;
background: #444;
background: -moz-linear-gradient(#444, #111);
background: -webkit-gradient(linear,left bottom,left top,color-stop(0, #111),color-stop(1, #444));
background: -webkit-linear-gradient(#444, #111);
background: -o-linear-gradient(#444, #111);
background: -ms-linear-gradient(#444, #111);
background: linear-gradient(#444, #111);
-moz-border-radius: 5px;
border-radius: 5px;
}
#menu ul li{
float: none;
margin: 0;
padding: 0;
display: block;
-moz-box-shadow: 0 1px 0 #111111, 0 2px 0 #777777;
-webkit-box-shadow: 0 1px 0 #111111, 0 2px 0 #777777;
box-shadow: 0 1px 0 #111111, 0 2px 0 #777777;
}
#menu ul li:last-child{
-moz-box-shadow: none;
-webkit-box-shadow: none;
box-shadow: none;
}
#menu ul a{
padding: 15px;
height: auto;
line-height: 1;
display: block;
white-space: nowrap;
float: none;
text-transform: none;
}
*html #menu ul a{ /* IE6 */
height: 10px;
width: 150px;
}
*:first-child+html #menu ul a{ /* IE7 */
height: 10px;
width: 150px;
}
#menu ul a:hover{
background: #0186ba;
background: -moz-linear-gradient(#04acec, #0186ba);
background: -webkit-gradient(linear, left top, left bottom, from(#04acec), to(#0186ba));
background: -webkit-linear-gradient(#04acec, #0186ba);
background: -o-linear-gradient(#04acec, #0186ba);
background: -ms-linear-gradient(#04acec, #0186ba);
background: linear-gradient(#04acec, #0186ba);
}
#menu ul li:first-child a{
-moz-border-radius: 5px 5px 0 0;
-webkit-border-radius: 5px 5px 0 0;
border-radius: 5px 5px 0 0;
}
#menu ul li:first-child a:after{
content: '';
position: absolute;
left: 100px;
top: -8px;
width: 0;
height: 0;
border-left: 5px solid transparent;
border-right: 5px solid transparent;
border-bottom: 8px solid #444;
}
#menu ul li:first-child a:hover:after{
border-bottom-color: #04acec;
}
#menu ul li:last-child a{
-moz-border-radius: 0 0 5px 5px;
-webkit-border-radius: 0 0 5px 5px;
border-radius: 0 0 5px 5px;
}
/* Clear floated elements */
#menu:after{
visibility: hidden;
display: block;
font-size: 0;
content: " ";
clear: both;
height: 0;
}
a.btn-function {
background-image: url(../ovolo/img/btn_function.png);
background-color: red;
background-size: 27px;
background-repeat: no-repeat;
display: block;
position: relative;
margin: 0px 5px 0 90px;
float: left;
}
The problem is you are applying the red box to the a element, but taking action on the (larger) li parent element.
You can change your selector to (Fiddle):
#menu li a:hover + ul, #menu li a + ul:hover{
display: block;
z-index: 99;
}
This is not a perfect fix because of the dead space between the a and the ul though, the best option would be to make the a take up the entire space of the li.
Hello,
Can someone help me, how can i stretch the background of the menu (to be full width, from left to right)?
I'm a beginner.
Thanks.
#menu, #menu ul {
margin: 0;
padding: 0;
list-style: none;
}
#menu {
width:100%;
margin: 0px;
background-color: #3d56ac;
background-image: linear-gradient(#444, #111);
}
#menu:before,
#menu:after {
content: "";
display: table;
}
#menu:after {
clear: both;
}
#menu {
zoom:1;
}
#menu li {
float: left;
border-right: 1px solid #222;
box-shadow: 1px 0 0 #444;
position: relative;
}
#menu a {
float: left;
padding: 12px 30px;
color: #FFF;
text-transform: uppercase;
font: bold 12px Arial, Helvetica;
text-decoration: none;
text-shadow: 0 1px 0 #111;
}
#menu li:hover > a {
color: #fafafa;
}
*html #menu li a:hover { /* IE6 only */
color: #fafafa;
}
#menu ul {
margin: 20px 0 0 0;
_margin: 0; /*IE6 only*/
opacity: 0;
visibility: hidden;
position: absolute;
top: 38px;
left: 0;
z-index: 1;
background: #444;
background: linear-gradient(#444, #111);
box-shadow: 0 -1px 0 rgba(255,255,255,.3);
border-radius: 3px;
transition: all .2s ease-in-out;
}
#menu li:hover > ul {
opacity: 1;
visibility: visible;
margin: 0;
}
#menu ul ul {
top: 0;
left: 150px;
margin: 0 0 0 20px;
_margin: 0; /*IE6 only*/
box-shadow: -1px 0 0 rgba(255,255,255,.3);
}
#menu ul li {
float: none;
display: block;
border: 0;
_line-height: 0; /*IE6 only*/
box-shadow: 0 1px 0 #111, 0 2px 0 #666;
}
#menu ul li:last-child {
box-shadow: none;
}
#menu ul a {
padding: 10px;
width: 130px;
_height: 10px; /*IE6 only*/
display: block;
white-space: nowrap;
float: none;
text-transform: none;
}
#menu ul a:hover {
background-color: #0186ba;
background-image: linear-gradient(#04acec, #0186ba);
}
#menu ul li:first-child > a {
border-radius: 3px 3px 0 0;
}
#menu ul li:first-child > a:after {
content: '';
position: absolute;
left: 40px;
top: -6px;
border-left: 6px solid transparent;
border-right: 6px solid transparent;
border-bottom: 6px solid #444;
}
#menu ul ul li:first-child a:after {
left: -6px;
top: 50%;
margin-top: -6px;
border-left: 0;
border-bottom: 6px solid transparent;
border-top: 6px solid transparent;
border-right: 6px solid #3b3b3b;
}
#menu ul li:first-child a:hover:after {
border-bottom-color: #04acec;
}
#menu ul ul li:first-child a:hover:after {
border-right-color: #0299d3;
border-bottom-color: transparent;
}
#menu ul li:last-child > a {
border-radius: 0 0 3px 3px;
}
This should work:
#menu {
background-size: 100%;
}
You need to fix the width of the image... if your want to Stretch the background image...
**CSS**
background-image: url("menu.png");
background-size: 875px 125px;
background-repeat: no-repeat;
Hope this will helps you...
or you can try...
/css
body{margin: 0 auto;}
.menu100percent {
background: #3584b4; /* Old browsers */
background: -moz-linear-gradient(top, #3584b4 0%, #25567f 100%); /* FF3.6+ */
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#3584b4), color-stop(100%,#25567f)); /* Chrome,Safari4+ */
background: -webkit-linear-gradient(top, #3584b4 0%,#25567f 100%); /* Chrome10+,Safari5.1+ */
background: -o-linear-gradient(top, #3584b4 0%,#25567f 100%); /* Opera 11.10+ */
background: -ms-linear-gradient(top, #3584b4 0%,#25567f 100%); /* IE10+ */
background: linear-gradient(to bottom, #3584b4 0%,#25567f 100%); /* W3C */
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#3584b4', endColorstr='#25567f',GradientType=0 ); /* IE6-9 */
color: white;
font-size: 16px;
height: 37px;
width:100%;
}
.menu{width:1000px; margin: 0 auto; }
.menu a{color:#fff; font-size:12px; line-height:37px; font-family:Arial; text-decoration:none;}
/html
<div class="menu100percent">
<div class="menu">
Shop
</div>
</div>
DEMO HERE
I can't put my navigation menu to the right of screen. I used a lot of CSS but so it's a bit hard to find where is my mistake.
This is my html code:
<div id="main-container">
<div id="content">
<div id="header">
<ul id="nav">
<li >Nav 1</li>
<li>Nav 2</li>
<li class="selected">Nav 3</li>
<li>Nav 4</li>
</ul>
</div>
<div id="pictures">
</div>
</div>
This is the CSS i have trouble with:
#main-container {
}
#content {
background-color: #FFAA00;
background: url(images/table-surface-2-resized.jpg) repeat-x #000000;
width: 800px;
height: 600px;
border-radius: 5px;
}
#header {
background-color: #FFD200;
width: 800px;
height: 26px;
}
#pictures {
background-color: #A64D00;
width: 760px;
height: 540px;
border: 2px solid white;
border-radius: 15px;
margin-left: auto;
margin-right: auto;
margin-top: 14px;
}
/* TABS WITH ROUND, OUT BORDERS */
#nav {
text-align: center;
list-style: none;
margin: 0;
padding: 0;
line-height: 24px;
height: 26px;
overflow: hidden;
font-size: 12px;
font-family: verdana;
position: relative;
}
#nav li {
border: 1px solid #AAA;
background: #D1D1D1;
background: -o-linear-gradient(top, #ECECEC 50%, #D1D1D1 100%);
background: -ms-linear-gradient(top, #ECECEC 50%, #D1D1D1 100%);
background: -moz-linear-gradient(top, #ECECEC 50%, #D1D1D1 100%);
background: -webkit-linear-gradient(top, #ECECEC 50%, #D1D1D1 100%);
background: linear-gradient(top, #ECECEC 50%, #D1D1D1 100%);
display: inline-block;
position: relative;
z-index: 0;
border-top-left-radius: 6px;
border-top-right-radius: 6px;
box-shadow: 0 3px 3px rgba(0, 0, 0, 0.4), inset 0 1px 0 #FFF;
text-shadow: 0 1px #FFF;
margin: 0 -5px;
padding: 0 20px;
}
#nav li.selected {
background: #FFF;
color: #333;
z-index: 2;
border-bottom-color: #FFF;
}
#nav:before {
position: absolute;
content: " ";
width: 100%;
bottom: 0;
left: 0;
border-bottom: 1px solid #AAA;
z-index: 1;
}
#nav li:before,
#nav li:after {
border: 1px solid #AAA;
position: absolute;
bottom: -1px;
width: 5px;
height: 5px;
content: " ";
}
#nav li:before {
left: -6px;
border-bottom-right-radius: 6px;
border-width: 0 1px 1px 0;
box-shadow: 2px 2px 0 #D1D1D1;
}
#nav li:after {
right: -6px;
border-bottom-left-radius: 6px;
border-width: 0 0 1px 1px;
box-shadow: -2px 2px 0 #D1D1D1;
}
#nav li.selected:before {
box-shadow: 2px 2px 0 #FFF;
}
#nav li.selected:after {
box-shadow: -2px 2px 0 #FFF;
}
#nav a {
color: black;
text-decoration: none;
}
/* END TABS WITH ROUND, OUT BORDERS */
try out this css (addition)
#nav {
padding: 0 10px;
float:right;
}
here is working link
Fixed: http://dabblet.com/gist/3435951
Float #nav to the right, give it a right margin, remove overflow: hidden from it and add it on the #header.
I want simple drop-down menu. But I have one problem. I want when I hover over dropped items (drop-menu-items) my parent element (drop-menu-parent) to be colored with black, but it's in white. I can't explain it very well. You can see it here -> http://jsfiddle.net/YEyuP/
I think this is what you need : http://jsfiddle.net/YEyuP/6/
HTML:
<nav>
<ul id="cat-nav">
<li>About</li>
<li>Contact</li>
<li class="drop-menu-parent">
Portfolio
<ul class="drop-menu-items">
<li>Some other category</li>
<li>Some other category</li>
<li>Some other category</li>
<li>Some other category</li>
</ul>
</li>
<li>Testimonials</li>
<li>Browse Products</li>
<li>Support Forum</li>
</ul>
</nav>
CSS:
nav {
background: #000;
}
#cat-nav {
text-align: center;
background-color: #0f0609, #0f0609;
background-image: url(cat-nav-bg.jpg), url(cat-nav-bg-bottom.jpg);
background-repeat: no-repeat, repeat-y;
margin-top: -8px;
display: block;
}
#cat-nav:after {
content: " ";
display: block;
clear: both;
width: 81%;
padding-top: 8px;
margin: 0 auto;
background: url(teeth.png) repeat-x;
}
ul#cat-nav > li {
text-align: center;
display: inline-block;
}
#cat-nav a:link { color: #fff; text-decoration: none; padding: 10px; display: inline-block;}
#cat-nav a:hover { color: #fff; text-decoration: none; }
#cat-nav a:visited { color: #fff; text-decoration: none; }
#cat-nav a:active { color: #fff; text-decoration: none; }
ul .drop-menu-items {
position: absolute;
display: none;
background: #fff url(drop-menu-bg.png) bottom repeat-x;
-webkit-box-shadow: 0px 5px 5px #8f8f8f;
-moz-box-shadow: 0px 5px 5px #8f8f8f);
box-shadow: 0px 5px 5px #8f8f8f;
border-radius: 0 10px 10px 10px;
}
ul.drop-menu-items li{
background: url(drop-menu-bullet.png) no-repeat 5px center;
float: none;
position: relative;
color: #000;
padding: 5px 15px;
margin: 0 10px;
border-bottom: 1px dotted #cecece;
}
ul.drop-menu-items li:hover {
background: #f0f0f0 url(drop-menu-bullet.png) no-repeat 5px center;
}
.drop-menu-parent:hover .drop-menu-items {
display: block;
z-index: 1000;
}
#cat-nav > li:hover a{
color:#000;
}
ul#cat-nav li a:hover {
background: #fff;
border-radius: 5px;
/* padding-top: 5px; */
}
#cat-nav .drop-menu-items li a {
color: #000;
}
#cat-nav .drop-menu-items li:hover a {
text-decoration: underline;
background: none;
color: #000;
}
.drop-menu-parent:hover {
background: #fff;
background-color: #fff;
border-radius: 5px 5px 0 0;
}
explanation
What i have added is this :
#cat-nav > li:hover a{
color:#000;
}
'>' indicates a direct child...so the direct child of #cat-nav when hovered over will assign a black color to the tag.
You could have also written : #cat-nav .drop-menu-parent:hover > a { color:#000; }
And it would have worked just as well...Infact, this second bit is a better option.
Add:
ul#cat-nav li:hover a{
color: #000;
}
Not sure if I understood you right(?), but here's an example. Is this what you mean? jsFiddle
nav {
background: #000;
}
#cat-nav {
text-align: center;
background-color: #0f0609, #0f0609;
background-image: url(cat-nav-bg.jpg), url(cat-nav-bg-bottom.jpg);
background-repeat: no-repeat, repeat-y;
margin-top: -8px;
display: block;
}
#cat-nav:after {
content: " ";
display: block;
clear: both;
width: 81%;
padding-top: 8px;
margin: 0 auto;
background: url(teeth.png) repeat-x;
}
ul#cat-nav > li {
text-align: center;
display: inline-block;
}
#cat-nav a:link { color: #fff; text-decoration: none; padding: 10px; display: inline-block;}
#cat-nav a:hover { color: #fff; text-decoration: none; }
#cat-nav a:visited { color: #fff; text-decoration: none; }
#cat-nav a:active { color: #fff; text-decoration: none; }
ul .drop-menu-items {
position: absolute;
display: none;
background: #000 url(drop-menu-bg.png) bottom repeat-x;
-webkit-box-shadow: 0px 5px 5px #8f8f8f;
-moz-box-shadow: 0px 5px 5px #8f8f8f);
box-shadow: 0px 5px 5px #8f8f8f;
border-radius: 0 10px 10px 10px;
}
ul.drop-menu-items li{
background: url(drop-menu-bullet.png) no-repeat 5px center;
float: none;
position: relative;
color: #000;
padding: 5px 15px;
margin: 0 10px;
border-bottom: 1px dotted #cecece;
}
ul.drop-menu-items li:hover {
background: #000 url(drop-menu-bullet.png) no-repeat 5px center;
}
.drop-menu-parent:hover .drop-menu-items {
display: block;
z-index: 1000;
}
ul#cat-nav li a:hover {
background: #000;
border-radius: 5px;
color: #fff;
/* padding-top: 5px; */
}
#cat-nav .drop-menu-items li a {
color: #fff;
}
#cat-nav .drop-menu-items li:hover a {
text-decoration: underline;
background: none;
color: #fff;
}
.drop-menu-parent:hover {
background: #000;
background-color: #000;
border-radius: 5px 5px 0 0;
}