开发者

CSS colors problem

开发者 https://www.devze.com 2023-03-26 20:04 出处:网络
with a mixing of colors in different tags. My source is: <div id=\"page_header\"> <div id=\"header_logo\">

with a mixing of colors in different tags. My source is:

<div id="page_header">

  <div id="header_logo">
    <a href=index.php>
      <img src="css/images/header.png" border="0" />
    </a>
  </div>

  <div id="main_menu">
    <ul>
      <li>
        <a href="http://mvc.local/blog">Blog</a>
      </li>
      <li>
        <a href="http://mvc.local/welcome">Welcome</a>
      </li>
    </ul>
  </div>
</div>

and on the bottom in footer menu:

<div id="page_footer">
  <p>&copy; 2011 Stefan Cvetkovic.</p>

  <div id="footer_menu">
    <ul>
      <li><a href="#">About</a></li>
      <li><a href="#">Terms of Service</a></li>
      <li><a href="#">Privacy</a></li>
    </ul>
  </div>
</div>

My css source:

#main_menu{
    width:100%;
    height:40px;
    background: url(images/menubg.png) repeat-x;
}
#main_menu ul{
    list-style: none;
    margin: 0;
    padding: 10px 0 0 10px;
}
#main_menu ul li, #footer_menu ul li{
    padding:0;
    margin: 0 20px 0 0;
    display:inline;
}
#main_menu ul li a:link,a:visited,a:active{
    text-decoration:  none;
    font-weight:bold;
    color:#ffffff;
}
#main_menu ul li a:hover{
    text-decoration:  none;
    font-weight:bold;
    color:#000000;
}
#footer_menu ul{
    list-style: none;
    ma开发者_如何学JAVArgin: 0;
    padding: 10px 0 0 10px;
}
#footer_menu ul li{
    padding:0;
    margin: 0 20px 0 0;
    display:inline;
}
#footer_menu ul li a:link,a:visited,a:active{
    text-decoration:  none;
    color: #000000;

}
#footer_menu ul li a:hover{
    text-decoration:  none;
    color: #000000; 
}

Probem is becouse my footer menu rules is on main menu, no difference in colors. Can anyone help, sry for bad english.


For every CSS deceleration that has the styling that you need, append the path to the element you want to add the styling to:

#main_menu ul li a:link,a:visited,a:active, #main_menu ul li a:link{
    ...
}
#main_menu ul li a:hover, #footer_menu ul li a:hover{
    ...
}

Edit: Just read your comment: the problem is that you append more styling, you should include the full path not just the element name:

#footer_menu ul li a:link,a:visited,a:active{}
#footer_menu ul li a:link,#footer_menu ul li a:visited,#footer_menu ul li a:active{}
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号