Home > Article > Web Front-end > What are the types of css pseudo-classes?
css pseudo-classes are divided into two types: UI pseudo-classes and structured pseudo-classes. UI pseudo-classes are divided into link pseudo-classes, focus pseudo-classes and target pseudo-classes. Structured pseudo-classes are divided into [:first-child], [:last-child] and [:nth-child].
CSS pseudo-classes are divided into two types:
1. UI pseudo-classes: when the HTML element is in a certain state (such as the mouse pointer located on the connection) to apply a CSS style to that element.
2. Structured pseudo-class: When there is a certain structural relationship in the markup (such as an element being the first or the last in a group of elements), CSS styles are applied to the response elements. .
(Learning video sharing: css video tutorial)
UI pseudo-class: The most commonly used UI pseudo-class element is the link (a element).
It is divided into three types:
1. Link pseudo-class: There are four in total, and the link will always be in one of the four states.
(1) Link The link is there waiting for the user to click.
(2) The Visited user has clicked this link before.
(3)Hover The mouse pointer is hovering over the link.
(4) The Active link is being clicked (the mouse is pressed on the element but has not been released).
2. Focus pseudo-class (focus)
3. Target pseudo-class (if the user clicks on a link to another element in a carton page, that element is the target). You can use: The target pseudo-class selects it.)
Structured pseudo-class:
1.: first-child and: last-child
: first-child represents a group of sibling elements The first element in , and :last-child represents the last one.
2. :nth-child: Each nth item in a set of list items will be selected.
Related recommendations: CSS tutorial
The above is the detailed content of What are the types of css pseudo-classes?. For more information, please follow other related articles on the PHP Chinese website!