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