The ::first-line

  • Is used to add a special style to the first line of a text.
  • Can only be applied to block-level elements.
  • The following properties apply to the ::first-line pseudo-element: font properties, color properties, background properties, word-spacing, letter-spacing, text-decoration, vertical-align, text-transform, line-height, clear.

Demonstration code

//the following example formats the first line of the text in all <p> elements

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

The ::first-line — Structure map

Clickable & Draggable!

The ::first-line — Related pages: