CSS Landscape navigation Menu Instance Tutorial

Source: Internet
Author: User
CSS Horizontal navigation menu Instance Tutorial 2, another CSS navigation menu.


 
 
  1. <ul id= "NAV" >
  2. <li><a href= "http://www.alixixi.com/" >div+css tutorials </a></li>
  3. <li><a href= "http://www.alixixi.com/" id= "current" >css layout instance </a></li>
  4. <li><a href= "http://www.alixixi.com/" >css2.0 tutorials </a></li>
  5. <li><a href= "http://www.alixixi.com/" >css Cool Station Appreciation </a></li>
  6. <li><a href= "http://www.alixixi.com/" >css template download </a></li>
  7. <li><a href= "http://www.alixixi.com/" >CSS Online handbook </a></li>
  8. <li><a href= "http://www.alixixi.com/" >web standard </a></li>
  9. <li><a href= "http://www.alixixi.com/" >xhtml tutorials </a></li>
  10. </ul>

Look at the CSS code:

 
 
  1. * {
  2. font-size:12px;
  3. Text-align:center;
  4. }
  5. #nav {
  6. width:683px;
  7. margin:20px Auto 0 auto;
  8. border:1px solid #ccc;
  9. Border-right:none;
  10. }
  11. #nav Li {
  12. Display:inline;
  13. List-style-type:none;
  14. }
  15. #nav Li A:link, #nav Li a:visited {
  16. Float:left;
  17. PADDING:3PX 10px;
  18. Text-decoration:none;
  19. Color: #bbb;
  20. Background: #f0f0f0;
  21. border-right:1px solid #ccc;
  22. }
  23. #nav Li A:hover {
  24. Color: #fff;
  25. Background: #06c;
  26. }
  27. #nav Li A#current {
  28. Color: #fff;
  29. Background: #f60;
  30. }

Let's take a look at the important parts of the analysis:

Unordered list The border of UL is the solid line of a pixel, the color is #ccc, but the right border line is none.
This is where the border of our menu element is left.

 
  
  
  1. #nav {
  2. border:1px solid #ccc;
  3. Border-right:none;
  4. }
  5. #nav Li A:link, #nav Li a:visited {
    border-right:1px solid #ccc;
    }

Link element, we set the right box to a pixel solid line, the color is #ccc.

This forms a closed area as a container for the linked elements. It looks good.

 
  
  
  1. #nav Li A#current {
  2. Color: #fff;
  3. Background: #f60;
  4. }

This represents the attribute with the ID current in the LINK element. The text color is #fff, and the background is #f60.
This setting is something we should remember and it can be set to the ID of the menu for the current page. For example, we are now in the CSS Tutorial section. We set the ID of the CSS Tutorial menu to current. It will be displayed in a different style than the other menu. There are other ways to give the body an ID. That is, you can control the entire page needs to be annotated parts, such knowledge we in the future article is detailed introduction.



Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.