[CSS Selector] E:first-line
Using selector:first-line, you can apply styles to the first rendered line of an element. This is commonly called a "pseudo-element." It does not work in IE8 or earlier.
Note that this applies to the first line as rendered by the browser, not the first line in the source code. Additionally, :first-line only works when the display property is set to block, inline-block, table-cell, table-caption, etc. It does not apply to inline elements.
Sample Code
p:first-line { color: red;} /* Makes the first rendered line red. */
Browser Preview
p:first-line { color: red;} /* Makes the first rendered line red. */
<p> The first rendered line becomes red. Note that this is not the first line of the source code.<br> </p>
Browser Compatibility
8 △
7 △
6 △
6 △
5 △
4 △
2 or earlier ×
Android Browser
4.4+ ○
3 or earlier ×※ Version data based on MDN.
If you find any errors or copyright issues, please contact us.