CSS :first-letterSelectors

Complete CSS Selector Reference Manual

Example

The style for the first letter of each <p> element:

p:first-letter
{
font-size:200%;
color:#8A2BE2;
}

Try it Yourself »

Definition and Usage

The :first-letter selector is used to specify the style of the first letter of an element.

Tip:The :first-letter selector can use the following properties:

  • font properties
  • color properties 
  • background properties
  • margin properties
  • padding properties
  • border properties
  • text-decoration
  • vertical-align (only if float is 'none')
  • text-transform
  • line-height
  • float
  • clear

Note:The "first-letter" selector only applies to block-level elements.


Browser Support

The numbers in the table indicate the first browser version number that supports the property.

Selectors
::first-letter 1.0 9.0
Partial from 5.5
1.0 1.0 7.0
Partial from 5.5

Note:IE 5.5-8 and Opera 4-6 only support the old syntax standard, single-colon CSS2 syntax (:first-letter). New versions support the standard, double-colon CSS3 syntax (::letter).


Related Pages

CSS Tutorial:CSS Pseudo-classes


Complete CSS Selector Reference Manual

other extensions