/    Sign up×
Community /Pin to ProfileBookmark

So I am pretty rookie when it comes to css. I want just the drop down menu of the NAV4 to be a different color then the rest of the menu in my navigation.

this is my css:

[CODE]ul {
margin: 0;
padding: 0;
list-style: none;
width: 150px;
}
ul li {
position: relative;
<font size=”1″ color=”#BFBFBE”>
}
li ul {
position: middle;
left: 135px;
top: 0;
display: none;
color: black;
}
ul li a {
display: block;
text-decoration: none;
color: #777;
background: ;
padding: 5px;
border: 0px solid #ccc;
border-bottom: 0;
}
/* Fix IE. Hide from IE Mac */
* html ul li { float: left; }
* html ul li a { height: 1%; }
/* End */
ul {
margin: 0;
padding: 0;
list-style: none;
width: 150px;
}
li:hover ul {
display: block;
}

startList = function() {
if (document.all&&document.getElementById) {
navRoot = document.getElementById(“nav”);
for (i=0; i<navRoot.childNodes.length; i++) {
node = navRoot.childNodes[i];
if (node.nodeName==”LI”) {
node.onmouseover=function() {
this.className+=” over”;
}
node.onmouseout=function() {
this.className=this.className.replace»
(” over”, “”);
}
}
}
}
}
window.onload=startList;
li:hover ul, li.over ul {
display: block;
}
/* Fix IE. Hide from IE Mac */
* html ul li { float: left; height: 1%; }
* html ul li a { height: 1%; }
/* End */
a:hover {
color: #FEC80C;
text-decoration: none;
background-image: url(../images/arrow_nav.gif);
background-repeat: no-repeat;
background-position: 0 .5em;
}
body {
margin-left: 0px;
margin-top: 0px;
margin-right: 0px;
margin-bottom: 0px;
background-color: #000000;
}
a {
font-family: Arial, Helvetica, sans-serif;
font-size: 10px;
color: #D2D2D2;
font-weight: bold;
}
body,td,th {
font-family: Arial, Helvetica, sans-serif;
font-size: 10px;
color: #BFBFBE;
}[/CODE]

this is my html for the navigation:

[CODE]<li>
<div align=”center”><a href=”#”>NAV1</a></div>
</li>
<li>
<div align=”center”><img src=”images/dotted_nav.jpg” width=”127″ height=”3″ align=”middle” /></div>
</li>
<li><a href=”#”>NAV2</a></li>
<li>
<div align=”center”><img src=”images/dotted_nav.jpg” alt=”” width=”127″ height=”3″ align=”middle” /></div>
</li>
<li><a href=”#”>NAV3</a>
<li>
<div align=”center”><img src=”images/dotted_nav.jpg” alt=”” width=”127″ height=”3″ align=”middle” /></div>
<li><a href=”#”>NAV4<br />
</a>
<ul>
<li><a href=”#”> SUB1 </font></a></li>
<li><a href=”#”> SUB2 </font></a></li>
<li><a href=”#”> SUB3 </font></a></li>
</ul>
</li>
<li>
<div align=”center”><img src=”images/dotted_nav.jpg” alt=”” width=”127″ height=”3″ align=”middle” /></div>

<li><a href=”#”>NAV5</a>
<li>
<div align=”center”><img src=”images/dotted_nav.jpg” alt=”” width=”127″ height=”3″ align=”middle” /></div>
<li><a href=”#”>NAV6</a></li>
</ul>[/CODE]

So basically all I’m looking for is to make the sub menu in NAV4 be a different color (#BFBFBE) then the rest of the NAV. I want the same hover color however as the rest. I have tried so many different things and I can’t quite figure out what I am missing. Any help would be grateful and thanks in advance.

to post a comment
CSS

5 Comments(s)

Copy linkTweet thisAlerts:
@kdub718authorFeb 02.2008 — anyone have any idea? or is it possible?
Copy linkTweet thisAlerts:
@WebJoelFeb 02.2008 — ul li {

position: relative;

[B]<font size="1" color="#BFBFBE">[/B]

}[/QUOTE]
You are using HTML delimiters in CSS' "<style>". This is invalid.
ul li [B]{[/B]position: relative; font-size:12px; color"#bfbfbe;[B]}[/B][/QUOTE]
is probably closer to what you want to say here...

and:


....li:hover ul {

display: block;

}

[B]startList = function() {

if (document.all&&document.getElementById) {

navRoot = document.getElementById("nav");

for (i=0; i<navRoot.childNodes.length; i++) {

node = navRoot.childNodes[i];

if (node.nodeName=="LI") {

node.onmouseover=function() {

this.className+=" over";

}

node.onmouseout=function() {

this.className=this.className.replace&#187;

(" over", "");

}

}

}

}

}

window.onload=startList;
[/B]


li:hover ul, li.over ul {

display: block;

}

/* Fix IE. Hide from IE Mac */

*
html ul li { float: left; height: 1%; }

* html ul li a { height: 1%; }

/*
End */

a:hover {

color: #FEC80C;

text-decoration: none;...
[/QUOTE]
You are injecting javascipt into a CSS "<style>"? This won't work either. You need to enclose the [B]BOLD[/B] in "<script> ~ </script>" tags AFTER "</style>", or BEFORE the "<style>". Not 'in' the "<style></style>"



and while we're at it, thiscan be better:



....<li>

[B]<div align="center">[/B]<a href="#">NAV1</a>[B]</div>[/B]

</li>

<li>

[B]<div align="center">[/B]<img src="images/dotted_nav.jpg" width="127" height="3" align="middle" />[B]</div>[/B]

</li>

<li><a href="#">NAV2</a></li>

<li>

[B]<div align="center">[/B]...
[/QUOTE]


there is no need to place a block-level element such as a DIV in a "<li>" as a non-semantic container for another element. -You want an 'anchor' in the "<li>"? Then, place the anchor ("<a href="#">") in the "<li>~</li>". Any 'style' (such as [B]align="center"[/B]) appled to the DIV can be applied to the <li> with CSS instead as "<li [B]style="text-align:center;"[/B]></li>"...
Copy linkTweet thisAlerts:
@kdub718authorFeb 03.2008 — Thanks for the help... however NAV4 SUB's still won't change color... they stay the same color as the rest of the nav's... I have tried so many things and I'm just stumped as to why they won't change... its werid

[CODE]ul {
margin: 0;
padding: 0;
list-style: none;
width: 150px;
}
ul li {
position: relative;
font-size:12px;
color:#bfbfbe;}

li ul {
position: middle;
left: 135px;
top: 0;
display: none;
color: black;
}
ul li a {
display: block;
text-decoration: none;
color: #777;
background: ;
padding: 5px;
border: 0px solid #ccc;
border-bottom: 0;
}
/* Fix IE. Hide from IE Mac */
* html ul li { float: left; }
* html ul li a { height: 1%; }
/* End */
ul {
margin: 0;
padding: 0;
list-style: none;
width: 150px;
}
li:hover ul {
display: block;
}
li:hover ul, li.over ul {
display: block;
}
/* Fix IE. Hide from IE Mac */
* html ul li { float: left; height: 1%; }
* html ul li a { height: 1%; }
/* End */
a:hover {
color: #FEC80C;
text-decoration: none;
background-image: url(../images/arrow_nav.gif);
background-repeat: no-repeat;
background-position: 0 .5em;
}
body {
margin-left: 0px;
margin-top: 0px;
margin-right: 0px;
margin-bottom: 0px;
background-color: #000000;
}
a {
font-family: Arial, helvetica, verdana, georgia;
font-size: 10px;
color: #D2D2D2;
font-weight: bold;
}
body,td,th {
font-family: Arial, Helvetica, sans-serif;
font-size: 10px;
color: #BFBFBE;
}[/CODE]


any other ideas?
Copy linkTweet thisAlerts:
@CentauriFeb 03.2008 — How about [CODE]ul ul a {
color: #BFBFBE;
}[/CODE]
Copy linkTweet thisAlerts:
@kdub718authorFeb 03.2008 — Excellent...

I had tried that one earlier myself but I had it above "ul li a {" and I just tried it right below that tag and it worked... Just for the hell of it I tried "li li a{" and that tag works also... so that seems weird to me but heck what do i know I'm very "GREEN" so do speak with css... but I'm really digging it the more I keep at it..

again thanks a lot for both your guys replies much appreciated.
×

Success!

Help @kdub718 spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 4.28,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,

tipper: @Samric24,
tipped: article
amount: 1000 SATS,
)...