CSS :first-line selector
Complete CSS Selector Reference Manual
Example
Each
Style selected for the first line of an element:
p:first-line
{
background-color:yellow;
}
Try it »
Definition and Usage
:first-line selector is used to specify the style of the first line of a selector.
Note::first-line selector can use the following properties:
- font properties
- color properties
- background properties
- word-spacing
- letter-spacing
- text-decoration
- vertical-align
- text-transform
- line-height
- clear
Note: The "first-line" selector applies to block-level elements.
Browser support
The numbers in the table indicate the first browser version that supports this property.
| Selector | |||||
|---|---|---|---|---|---|
| ::first-line | 1.0 | 9.0 | |||
| Partially supported from 5.5 | 1.0 | 1.0 | 7.0 | ||
| Partially supported from 3.5 |
Related Articles
CSS Tutorial: CSS pseudo-classes