CSS ::first-letter (:first-letter) Selector

❮ Previous Selectors Next ❯

Example

p::first-letter {
  font-size: 1.5rem;
  font-weight: bold;
  color: red;
}

Meaning

The ::first-letter selector applies styles to the first letter of the first line of a block-level element, but only when not preceded by other content such as images or inline tables.

Note ::first-letter selector is same as :first-letter changed under CSS3 to make pseudo-elements obvious.

Version: CSS1




Standard Syntax

::first-letter (:first-letter) {
  css declarations;
}



Browser Support

The numbers in the table specify the first browser version that fully supports the property.




Status







Allowable properties

Only a small subset of CSS properties can be used with the ::first-letter pseudo-element:

❮ Previous Selectors Next ❯