CSS :first-letter pseudo-element
ExampleHow to style the first letter of all <p> elements:
Try it yourself » |
Definition and Usage
The :first-letter pseudo-element adds a style to the first letter of the specified selector.
Note: The following properties apply to the :first-letter pseudo-element:
- 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
Browser Support
The :first-letter selector is supported in all major browsers.
CSS Version
The :first-letter selector was first introduced in:
CSS 1
Related Pages
CSS tutorial: CSS Pseudo elements
Try it Yourself - Examples |
Pseudo-elements can also be combined with other CSS selectors and/or properties:
ExampleHow to style the first letter of the <p> element with id="hometown":
Try it yourself » |
ExampleThe :first-letter is often used in newspapercolumns to make a BIG first letter:
Try it yourself » |
Complete CSS Reference