This page is Ready to Use

Notice: The WebPlatform project, supported by various stewards between 2012 and 2015, has been discontinued. This site is now available on github.



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).


::first-line {}


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.


The following example puts the first line of any paragraph in bold text

p::first-line {
    font-weight: bold;

View live example



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


  • Microsoft Developer Network.