CSS ::first-line Pseudo-element
Example
Select and style the first line of every <p> element:
p::first-line
{
font-size: 20px;
text-decoration: underline;
background-color: lightgreen;
}
Try it Yourself »
Definition and Usage
The ::first-line
pseudo-element is used to style the first
line of a block-level element.
Note: The following properties can be used with ::first-line:
- all font properties
- all background properties
- color
- text-shadow
- word-spacing
- letter-spacing
- text-transform
- text-decoration
- text-decoration-color
- text-decoration-line
- text-decoration-style
- vertical-align
- line-height
Version: | CSS1 |
---|
Browser Support
The numbers in the table specifies the first browser version that fully supports the pseudo-element.
Pseudo-element | |||||
---|---|---|---|---|---|
::first-line | 1.0 | 9.0 | 1.0 | 1.0 | 7.0 |
CSS Syntax
Related Pages
CSS tutorial: CSS Pseudo elements