CSS :first-lineSelectors

Complete CSS Selector Reference Manual

Example

The style for the first line of each <p> element:

p:first-line
{
background-color:yellow;
}

Try it Yourself »

Definition and Usage

The :first-line selector is used to specify the style of the first line of the selector.

Note:The :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 number that supports the property.

Selectors
::first-line 1.0 9.0
Partial from 5.5
1.0 1.0 7.0
Partial from 3.5

Related Articles

CSS Tutorial:CSS Pseudo-classes


Complete CSS Selector Reference Manual

other extensions