Detailed explanation of pseudo-class selectors in CSS3

 

Difference between class selector and pseudo-class selector

  Class selectors can be named arbitrarily, while pseudo-class selectors are already defined selectors in CSS and cannot be named arbitrarily.

  

Pseudo-class selectors and pseudo-elements

  we put it here

  p.aaas{

  text-align: left;

  color: red;

  }



 

    it will also be selected

  Most common pseudo-class selector

  unvisited link

  a:link{ color: #ff6600 } /* unvisited link*/

  Let's test it, we add a hyperlink to it.

  Pseudo-class selector

  We give this pseudo-class selector, the selected style, the first

  a:link{

  color: #000;

  }

  link it is the unvisited link that represents

  Links that have been visited

  a:visited{

  color: fuchsia;

  }

  Then we put the mouse on it, a color.

  a:hover{

  color :green;

  }

  It turns green when we mouse over it. Another is when our mouse is being clicked.

  a:active{

  color: #ff6600;

  }

  It will display orange, which defines a pseudo-class. When our link has not been accessed, it is black. When our link has been accessed, when we return to this page, the color of this link will change. It turns purple. When we mouse over it, it turns green. When we click, it turns orange when we click the left mouse button, but it doesn't bounce back. OK, so let's see the effect.



 

  Now it is such a color, which is purple. Purple means we have already visited. Because we are now returning to this page, we can change it here to index1.

  Pseudo-class selector

  Because index1 does not exist, it will not exist and be accessed.



 

 So before there is no access, it is a black link, when our mouse moves up



 

   It will turn green, when we click the mouse but not release it, it will become

 



 

 

orange. It will visit when we release it, and it will turn purple after visiting. We create a new page index1, so it will turn purple when you click and return. This is the pseudo-class.

 

 

Original link: http://www.maiziedu.com/wiki/css3/selector/

 

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=327043235&siteId=291194637