What is the principle of css pseudo-class

The css pseudo-class principle refers to the classification of elements by pseudo-classes, which are based on characteristics, not their names, attributes or content; in principle, characteristics cannot be inferred from the document tree, and pseudo-classes can be dynamic in the sense of Yes, an element can acquire or lose a pseudo-class when the user interacts with the document.



The operating environment of this tutorial: windows7 system, css3 version, this method is suitable for all brands of computers.

Recommendation: "css video tutorial"

What is the principle of css pseudo-classes?

Explanation: Pseudo-classes classify elements based on characteristics rather than their names, attributes, or content; in

principle, characteristics cannot be inferred from the document tree. Perceived as pseudo-classes can be dynamic, an element can acquire or lose a pseudo-class when the user interacts with the document.

The exception is that ":first-child" can be inferred from the document tree, and ":lang" is also inferred from the document tree in some cases.

Pseudo-classes are: :first-child, :link:, vistited, :hover:, active:focus, :lang.

What is a pseudo-class?

It is that CSS itself gives it some features and functions, that is, you can use it directly without class=... or id=..., of course, you can also change some of its attributes such as: a:link{ color:#ff0000;}

Many CSS suggestions are not supported by browsers, but there are four pseudo-classes that can be used safely on connections. They are link, vistited, hover and active.

1

2

3

4

a:link{color:#000000;} /*Set the style of a object before it is accessed. */

a:hover{color:#000000;} /*Set the style of the object when it is hovered with the mouse. */

a:active{color:#000000;} /*Set the style of the object when it is activated by the user (the event that occurs between mouse click and release). */

a:visited{color:#000000;} /*Set the style of the a object when its link address has been visited. */

Guess you like

Origin blog.csdn.net/tt745/article/details/114110159