Several implementation methods of the tab bar (recommended)

Several implementation methods of the tab bar (recommended)

Tabs: Category + Description

Tag bar: Category => Let users know where they are and where they are going

1. CSS naming method:

XML/HTML CodeCopy content to clipboard
  1. < div   class = "service-tabs service-tabs1" >   
  2.   
  3.   < ul   class = "service-tabs-inner" >   
  4.     <   class = "on" > < a   href = " #nogo " > Follow </a> </li>   
  5.     < li > < a   href = "#nogo" > Recommendation </ a > </ li >     
  6.     < li > < a   href = "#nogo" > Navigation </ a > </ li >     
  7.     < li > < a   href = "#nogo" > Shopping </ a > </ li >     
  8.   </ ul >   
  9.   
  10. </ div >   
  11.   

Tab: tab

Advantages: 1. Easy to find 2. Comply with SEO standards

2. Layout:

1.<ul><li> </div>
1) float: clear float overflow:hidden;/pseudo class:after/
2) display:inline-block IE7 is not compatible: *display:inline;*zoom:1; White space: font-size:0;/same line/negative margin/letter-spacing

2.<table>

3. Template code:

1. Hover and add background color

CSS CodeCopy content to clipboard
  1. .service-tabs li a{ width : 160px ; height : 80px ; display : block ; color : #666 ; font-size : 32px ;}
  2. .service-tabs1 li a:hover{ color : #2CC185 ;}
  3. .service-tabs1 li.on a{ background-color : #2CC185 ; color : #fff ;} /*Background color*/   

2. Small triangle, obvious

CSS CodeCopy content to clipboard
  1. .service-tabs4 li{ position : relative ;}
  2. .service-tabs4 li a:hover{ color : #2CC185 ;}
  3. .service-tabs4 li.on a{ background-color : #2CC185 ; color : #fff ;}
  4. .service-tabs4 li i{ width : 11px ; height : 7px ; position : absolute ; bottom : - 6px ; left : 76px ; background : url (images/arrow.png); display : none ;}
  5. .service-tabs4 li.on i{ display : block ;}

3. Underline marking

CSS CodeCopy content to clipboard
  1. .service-tabs2 li a:hover{ color : #2CC185 ;}
  2. .service-tabs2 li.on a{ height : 78px ; border-bottom : 2px   solid   #2CC185 ; color : #2CC185 ;}

4. Script Implementation

JavaScript CodeCopy content to clipboard
  1. $( function (){ $( ".service-tabs ul li" ).click( function () { $( this ).addClass( "on" ).siblings().removeClass( "on" ); }); })
  2.   

Simple + Practical

The above several implementation methods of the tab bar (recommended) are all the content that the editor shares with you. I hope it can give you a reference. I also hope that you will support 123WORDPRESS.COM.

<<:  Detailed explanation of mkdir command in Linux learning

>>:  How to remove the blue box that appears when the image is used as a hyperlink

Recommend

How to use Docker to build OpenLDAP+phpLDAPadmin unified user authentication

1. Background Use LDAP to centrally manage operat...

Example code for using @media in CSS3 to achieve web page adaptation

Nowadays, the screen resolution of computer monit...

Detailed steps to install docker in 5 minutes

Installing Docker on CentOS requires the operatin...

vue perfectly realizes el-table column width adaptation

Table of contents background Technical Solution S...

js implements a simple countdown

This article example shares the specific code of ...

How to implement vue page jump

1. this.$router.push() 1. Vue <template> &l...

Implementation of fuzzy query like%% in MySQL

1, %: represents any 0 or more characters. It can...

Does the % in the newly created MySQL user include localhost?

Normal explanation % means any client can connect...

JavaScript implements draggable modal box

This article shares the specific code of JavaScri...

Sample code for programmatically processing CSS styles

Benefits of a programmatic approach 1. Global con...

js object to achieve data paging effect

This article example shares the specific code of ...

Sample code for making a drop-down menu using pure CSS

Introduction: When I looked at interview question...