Home  >  Article  >  Web Front-end  >  Use CSS to mark the current channel on the navigation bar

Use CSS to mark the current channel on the navigation bar

不言
不言Original
2018-07-02 09:52:551745browse

This article mainly introduces the use of CSS to mark the current channel on the navigation bar. It has a certain reference value. Now I share it with you. Friends in need can refer to

Webpage Production Webjx Article Introduction : The technology of using CSS to mark the current channel on the navigation bar has been around for a long time. It has been introduced in many CSS books, but it is still often asked, so I wrote a simple example to explain it.​​

In fact, the principle is very simple:
1) According to different channels (columns), define ids for the body respectively. For example:
Home page:
Blog channel:
Album channel:
All pages in the channel must define IDs uniformly.
2) The corresponding column of the navigation bar also defines id or class:

<ul id="nav">
<li class="nav_home"><a href="index.html">首页</a></li>
<li class="nav_blog"><a href="blog.html">Blog</a></li>
<li class="nav_album"><a href="album.html">相册</a></li>
</ul>

3) The current position is distinguished by different body ids:

#p_home .nav_home a,
#p_blog .nav_blog a,
#p_album .nav_album a {
……
}

The above is the entire content of this article , I hope it will be helpful to everyone’s learning. For more related content, please pay attention to the PHP Chinese website!

Related recommendations:

Introduction to jQuery browser CSS3 close-up compatibility

The above is the detailed content of Use CSS to mark the current channel on the navigation bar. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn