#nav css affecting all elements in page.

Posted by Sam Gabriel on Stack Overflow See other posts from Stack Overflow or by Sam Gabriel
Published on 2010-12-31T14:35:16Z Indexed on 2010/12/31 14:54 UTC
Read the original article Hit count: 263

Filed under:

Hey guys I set up this CSS file to use on the navbar:

#nav
{
    background-color: #98bf21;
    } 
#nav li
{
float:left;
}
#nav li ul{
    position: absolute;
    width: 172px;
    left: -999em;
    }

#nav li:hover ul{
    left: auto;
    }   
#nav a:link,a:visited
{
display:block;
width:164px;
font-weight:bold;
color:white;
background-color:#98bf21;
text-align:center;
padding:4px;
text-decoration:none;
text-transform:uppercase;
}
#nav a:hover,a:active
{
background-color: #7A991A;
}

And it seems to be affecting all the elements. For example all elements take the styles if the #nav a styles. Is there something I'm missing here? I'm new to web design.

© Stack Overflow or respective owner

Related posts about css