Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.


  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • DownloadDownload
  • PrintPrint
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;}