SEO Audit Dashboard

The ::first-letter pseudo-element in CSS allows developers to apply styles to the first letter of the first line in a block-level container. It is a popular feature for creating eye-catching designs, such as drop caps in articles or stylized headlines.

Key Points:

  • Targeting the First Letter: This pseudo-element is used to style only the first letter, provided there is no preceding content like images or inline elements.
  • Punctuation Handling: The ::first-letter also includes punctuation that may appear directly before or after the first letter, making it important to test in cases of text with quotes or special characters.
  • Languages with Digraphs: In languages like Dutch, where two letters form a digraph (e.g., “IJ”), the pseudo-element should style both letters, but browser support for such cases is currently inconsistent.

Style Properties:

Ad Section After Last Paragraph

The ::first-letter pseudo-element supports a limited set of CSS properties. These include:

  • Font styles: Control typography with properties like font-family, font-size, and font-weight.
  • Color and Background: Modify the text’s color, add background-color, or even use background images.
  • Margins and Padding: Adjust the spacing around the letter using margin and padding.
  • Borders: Style borders around the first letter using border properties.
  • Text decoration: Apply text-shadow, text-transform, letter-spacing, and text-decoration for advanced typographic effects.