CSS: First Line

By Xah Lee. Date: . Last updated: .

The ::first-line CSS: Pseudo Element let you style the first formatted line.

The first line is determined by rendering, not by physical line break.

Example

Alice was beginning to get very tired of sitting by her sister on the bank, and of having nothing to do: once or twice she had peeped into the book her sister was reading, but it had no pictures or conversations in it, «and what is the use of a book,» thought Alice «without pictures or conversation?».

Code

p.fline274::first-line {
color:red;
}
<p class="fline274">Alice was beginning to get very tired of sitting by her sister on the bank, and of having nothing to do: once or twice she had peeped into the book her sister was reading, but it had no pictures or conversations in it, «and what is the use of a book,» thought Alice «without pictures or conversation?».</p>

CSS, Text Decoration