::first-line
Summary
Represents the first line of an element. Note that the content of the first line varies depending on the available width and the styling of text (size, spacing).
Syntax
::first-line {}
Usage
The ::first-line pseudo-element can be attached to block-level elements. It can be attached to inline elements if you set the corresponding display property to block.
Examples
The following example puts the first line of any paragraph in bold text
p::first-line {
font-weight: bold;
}
Notes
Remarks
Only the following properties apply to the ::first-letter pseudo-element: background, clear, color, font, font-family, font-size, font-style, font-variant, font-weight, line-height, text-decoration, text-transform, vertical-align, and word-spacing
Related specifications
- W3C CSS 2.1 Selectors
- W3C Recommendation
- W3C CSS Selectors Level 3
- W3C Recommendation
Attributions
Microsoft Developer Network.