HTML list problem?

Another quicky.

I've got it so that the text background goes white when you scroll over, how do I do this so that the whole <li> blue and the text color goes to white?


This is how I have it atm..

#nav {text-decoration:none;
width: 200px;
height: 200px;
float:left;
clear:none; }

div#nav ul{padding:0;}


#nav ul a{
width:165px;
font-size:100%;
text-decoration:none;
color:#49C2F7;}


#nav li
{line-height: 25px;
list-style-type: none;
border-bottom-width: 1px;
border-bottom-style: solid;
border-bottom-color: #666666;
text-transform: capitalize;}


#nav li a:hover{color: #FFF; background-color: #FFF;}

Thanks.
 
What you do (or can do, rather) is force the <a> to take up all the width, then you change the <a>'s properties rather than the <li>'s, mainly because of the a:hover support.

First of all make the <a> use the available width:

Code:
html>body #nav li a {
width:auto;
}
Then change the font and background colour via a:hover:

Code:
#nav li a:hover {
background: blue;
color: #fff;
}
Also, add some padding to the a{} if you want to, er, um...pad it [the color] out a bit :)
 
Sorry mate, it wasnt working! It only changed the text to white when I scrolled over that.

Really confused now, going to give up and have a bath!

#nav ul a{
width:200px;
font-size:100%;
text-decoration:none;
color:#49C2F7;}


#nav li
{line-height: 25px;
list-style-type: none;
border-bottom-width: 1px;
border-bottom-style: solid;
border-bottom-color: #666666;
text-transform: capitalize;}


#nav li a {
padding-left: 5px;

width:auto;
font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 11px;
font-size: 11px;
color: #49C2F7;
}

#nav li:hover {
background: #49C2F7;
color: #fff;}

#nav li a:hover {
padding-left: 5px;
color: #fff;}

Thats the code. :(
 
Whoops, ignore me I talk rubbish. display:block is kinda crucial :)

Code:
#nav li a {
padding-left: 5px;
display:block;
width:auto;
font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 11px;
font-size: 11px;
color: #49C2F7;
} 

#nav li a:hover {
padding-left: 5px;
background: #49C2F7;
color: #fff;
}

Remove the #nav li:hover section - the reason you can't use it is because the ever-wonderful IE doesn't support :hover /etc on anything apart from <a>'s :(
 
Can anyone help?

Fine in FF but all misaligned etc in IE.

Everyone always says FF causes problems but its always the other way round for me!
 
Back
Top Bottom