# first-line pseudo-element

The `first-line` pseudo-element allows you to style the first line of a text.

## Syntax

`selector::first-line { }`

## Example

Let's color the first line of a text in each paragraph red:

`<p> some text... </p> <p> some text... </p>` `p::first-line { color: red; } p { width: 300px; text-align: justify; }`

:

## Example

Let's set the paragraph width as a percentage. Run the given code and change the width of the browser window:

`<p> some text... </p> <p> some text... </p>` `p::first-line { color: red; } p { width: 50%; margin: 0 auto; text-align: justify; }`

:

← →
↑
en ru