Pseudo-elements

A pseudo-element can be used to style specific information in a chosen element, such as:

  • The first-line pseudo-element (first-line) is the first line of text content of the chosen element.
  • The first-letter pseudo-element (first-letter) is the first letter of text content of the chosen element.

Double colons are used to join a pseudo-element to an element or to a class, as can be seen in the example.

Here the first letter of each paragraph is red, and the first line of each element in the class key is in italics.

Note:

Hints:

  • undefined
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
1
2
<!DOCTYPE html>
<html lang="en">
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
1
2
p {
    width20rem;
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX