O'Reilly logo

CSS Pocket Reference, 4th Edition by Eric A. Meyer

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Name

text-indent

CSS2 Values:

<length> | <percentage>

CSS3 Values:

[ <length> | <percentage> ] && [ hanging || each-line ]?

Initial value:

0

Applies to:

Block-level elements

Inherited:

Yes

Percentages:

Refer to the width of the containing block

Computed value:

For percentage values, as declared; for length values, the absolute length

Description:

Defines the indentation of the first line of content in a block-level element. It is most often used to create a tab effect. Negative values are permitted and cause outdent (or hanging indent) effects. In CSS3, the value each-line will apply the indentation to any new line that results from a forced line break (e.g., due to a <br> element) within the element, not just the first line. The value hanging inverts the defined pattern of indentation, allowing for the creation of an outdent effect without using a negative length value.

Examples:

p {text-indent: 5em;}
h2 {text-indent: −25px;}

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required