Use CSS to mark the implementation of the current page effect on Web navigation

Source: Internet
Author: User
css| Navigation | Page Current page-for example, now the page is the homepage, then the first page of the navigation bar color and other columns are different, to give visitors a clear indication.

Below the specific approach, the basic menu implementation and the general CSS menu is not much different, focusing on how to implement the current page.

Set up a menu of 5 columns: Home, about, products, services, contacts, respectively, to each column a id,m1-m5,css can be written as follows:
#home #nav li#m1 A, #about #nav li#m2 A, #products #nav li#m3 A, #services #nav li#m4 A, #contact #nav li#m5 a{color: #FFF ; Background: #DC4E1B URL (navbg.gif) no-repeat; }

Xhtml:
<ul id= "NAV" >
<li id= "M1" ><a href= "index.html" >Home</a></li>
<li id= "m2" ><a href= "about.html" >About</a></li>
<li id= "M3" ><a href= "products.html" >Products</a></li>
<li id= "M4" ><a href= "services.html" >Services</a></li>
<li id= "M5" ><a href= "contact.html" >Contact</a></li>
</ul>
Then give each page the Bady label a separate ID, for example, to the first page ID is home, the rest of the analogy.

The advantage of this approach is that each page menu is the same, easy to modify, dynamic page contains also easy.

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.