CSS ::first-letter Pseudo-element
Example
Select and style the first letter of every <p> element:
p::first-letter {
font-size: 200%;
font-weight: bold;
color: #8A2BE2;
}
Try it Yourself »
Definition and Usage
The CSS ::first-letter
pseudo-element is used to style the first letter of
a block-level element.
Note: The following properties can be used with ::first-letter:
- all font properties
- all background properties
- all margin properties
- all padding properties
- all border properties
- color
- text-decoration
- text-shadow
- letter-spacing
- word-spacing
- text-transform
- text-decoration-color
- text-decoration-line
- text-decoration-style
- box-shadow
- vertical-align (only if float is 'none')
- line-height
- float
Version: | CSS1 |
---|
Browser Support
The numbers in the table specifies the first browser version that fully supports the pseudo-element.
Pseudo-element | |||||
---|---|---|---|---|---|
::first-letter | 1.0 | 9.0 | 1.0 | 1.0 | 7.0 |
CSS Syntax
Related Pages
CSS tutorial: CSS Pseudo elements