Home > Web Front-end > HTML Tutorial > Navigation bar problem_html/css_WEB-ITnose

Navigation bar problem_html/css_WEB-ITnose

WBOY
Release: 2016-06-24 11:46:18
Original
1158 people have browsed it

Similar to Baidu News:

When I first entered Baidu News, the homepage was selected by default.


And when I click on the Internet, the hyperlink of the Internet is selected.



How is this technology implemented? Is there any place to study? Can you give me a general idea?


Reply to the discussion (solution)

I took a look and this is what Baidu does: add class=current
to the selected tag and then The css file contains:

menu-list .current a {    color: #304E80;    border-bottom: 3px solid #3064BB;    text-decoration: none;}
Copy after login
Copy after login


This completes the effect~

changes its own style when clicked, and changes the styles of all other li's at the same time!

I took a look and this is what Baidu does: add class=current
to the selected tag and then the css file contains:

menu-list .current a {    color: #304E80;    border-bottom: 3px solid #3064BB;    text-decoration: none;}
Copy after login
Copy after login


like this This is the effect~


Do you need to use JS? Get the ID of an element and then change the style?

You make 2 pages

One page, the home page is selected

One page, the Internet is selected


Then the Internet inside the home page Click to jump to the Internet page

You make 2 pages

One page The home page is selected

One page The Internet is selected


Then click on "Internet" in the "Home Page" to jump to the "Internet Page"


This method is so stupid!

http://www.96kb.com/uploadfile/201311/6152345.zip
Check out the complete demo! Same as Baidu News!

a:active


You make 2 pages

One page The homepage is selected

One page Internet It is in the selected state


and then click on Internet in the home page to jump to the Internet page


This method is so stupid!

Pages visited by large traffic are not like this in the end

You can write it with jq. When the mouse passes over the Internet, add the .current class and other brothers delete the class

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template