freeCodeCamp/guide/english/css/selectors/pseudo/first-line/index.md

716 B

title
First-Line

First-Line

The ::first-line CSS pseudo-element styles the first line of a selected HTML element.

General Syntax:

::first-line

Example

/* "First line of every paragraph is set to bold*/
p::first-line {
  font-weight: bold;
}

The ::first-line CSS pseudo-element is often paired with the ::first-letter CSS pseudo-element for a drop caps effect emphasizing the first letter and line of a paragraph.

More Information: