CSS navigation, menu corresponding to the implementation of the page switching effect method

Source: Internet
Author: User

Implementation principle:

    • Each menu has more than one Li tag, and each Li tag contains an ID for the id,li tag to mark: Click Effect
    • Each page has an ID that corresponds to the page of each of the Li tag's clickable links, and it is used to mark: The href of the Li tag points to the page location
    • The pointer to the href of the Li tag, pointing to the unique page ID through the pseudo-class target: #app-version:target, if not intended to have a click effect, can be in the sibling selector ~ followed by the ID of the current Li tag, if you want to have a click effect, The sibling selector ~ followed by all parent nodes of the current Li tag

Css:

/* Click menu, check status effects */   #home: Target ~ #link-home,  #app-version:target ~ #header #navigation #link-portfolio,  #app-config: Target ~ #header #navigation #link-cpmfig,  #app-changelog:target ~ #header #navigation #link-contact,  # App-infomation:target ~ #header #navigation #link-infomation,  #about: Target ~ #header #navigation #link-about {        background: #333;         Color: #fff;  }

Html:

<Body>  <!--page Chunks -  <DivID= "Home"class= "Content"></Div>  <!--App version Query -  <DivID= "App-version"class= "Panel"></Div>  <!--App Configuration version -  <DivID= "App-config"class= "Panel"></Div>  <!--App-changelog -  <DivID= "App-changelog"class= "Panel"></Div>  <!--Instructions for use -  <DivID= "App-infomation"class= "Panel"></Div>  <!--About Us -  <DivID= "about"class= "Panel"></Div>  <!--Menu Block -  <DivID= "header"><ulID= "Navigation">     <Li><aID= "Link-home"href= "#home">Home</a></Li>     <Li><aID= "Link-portfolio"href= "#app-version">App version Query</a></Li>     <Li><aID= "Link-cpmfig"href= "#app-config">App Configuration version</a></Li>     <Li><aID= "Link-contact"href= "#app-changelog">Change Log</a></Li>     <Li><aID= "Link-infomation"href= "#app-infomation">Instructions for use</a></Li>     <Li><aID= "Link-about"href= "#about">About Us</a></Li></ul>  </Div></Body>

CSS navigation, menu corresponding to the implementation of the page switching effect method

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.