What are Pseudo elements and Pseudo classes?


Pseudo-elements allows us to create items that do not normally exist in the document tree, for example ::after.

In the below example, the color will appear only on the first line of the paragraph.

p: :first-line {
	color: #ffOOOO;
	font-variant: small-caps;
}

Pseudo-classes select regular elements but under certain conditions like when the user is hovering over the link.

For an example in the pseudo-class, In the below example, the color applies to the anchor tag when it’s hovered.

/* mouse over link */
a:hover {
	color: #FFOOFF;
}

 



Article ID: 1064
Created: Fri, Jun 3, 2022
Last Updated: Fri, Jun 3, 2022
Author: Administrator

Online URL: https://www.articlediary.com/article/what-are-pseudo-elements-and-pseudo-classes-1064.html