O'Reilly logo

CSS Pocket Reference, 4th Edition by Eric A. Meyer

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Name

::first-letter

Generates:

A pseudo-element that contains the first letter of an element

Description:

This is used to style the first letter of an element. Any leading punctuation should be styled along with the first letter. Some languages have letter combinations that should be treated as a single character, and a user agent may apply the first letter style to both. Prior to CSS2.1, :first-letter could be attached only to block-level elements. CSS2.1 expanded its scope to include block, list-item, table-call, table caption, and inline-block elements. There is a limited set of properties that can apply to a first letter.

Examples:

h1:first-letter {font-size: 166%;}
p:first-letter {text-decoration: underline;}

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required