CSS :first-letter selector
Complete CSS Selector Reference Manual
Example
Each
Style selected for the first letter of an element:
p:first-letter
{
font-size:200%;
color:#8A2BE2;
}
Try it »
Definition and Usage
:first-letter selector is used to specify the style of the first letter of an element.
Tip: :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 that supports this property.
| Selector | |||||
|---|---|---|---|---|---|
| ::first-letter | 1.0 | 9.0 | |||
| Partially supported from 5.5 | 1.0 | 1.0 | 7.0 | ||
| Partially supported from 5.5 |
**Note:** IE 5.5-8 and Opera 4-6 only support the old syntax standard, the single-colon CSS2 syntax (:first-letter). Newer versions support the standard double-colon CSS3 syntax (::first-letter).
Related Pages
CSS Tutorial: CSS pseudo-classes