6.4 Intermediate
Now, we introduce selectors corresponding to the state, part or attribute of an HTML element.
Pseudo-class
The pseudo-class (
:
) specifies a special state of the selected elements.Examples:
Pseudo-element
The pseudo-element (
::
) specifies a part to modify of the selected element.Examples:
p::before {
content: "random words: ";
}
p::first-letter {
text-transform: uppercase;
}
p::after {
content: "blah blah blah blah";
}
- Eye-catching application
of the
::before
and::after
pseudo-elements.
Attributes
Attributes are aditional values that configure or adjust the behaviour of HTML elements.
Examples: