English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

CSS Reference Manual

CSS @rules

Complete List of CSS Properties

CSS text-Usage and example of indent attribute

text-The indent CSS attribute specifies the indentation of the first line of text within an element.

The following table explains the usage and version history of this attribute, as well as its usage syntax in JavaScript scripts.

Default value:0
Applicable to:Block and inline block elements, table cells
Inheritance:Yes
Can be animated:Yes.Please refer to Animation attributes.
Version:CSS 1,2,3
JavaScript syntax:object.style.textIndent="50px"

text-Syntax of indent usage

The syntax of this attribute is as follows:

text-indent: length | percentage | initial | inherit

The following examples demonstrate how to use text-indent attribute.

  p {
   text-indent: 100px;
  }
Test to see‹/›

Attribute value

The following table describes the value of this attribute.

ValueDescription
lengthSpecify a fixed length indentation. Negative values are allowed.
percentageIndent is the percentage (%) of the containing block width. Negative percentage values can be used.
initialSet this attribute to its default value.
inheritIf specified, the associated element adopts its parent element text-The value of the indent attribute.

Browser compatibility

text-Browser compatibility of the indent attribute; the numbers in the table below represent the minimum browser version that supports this attribute; all mainstream browsers support this attribute.

  • Firefox 1+

  • Google Chrome1+

  • Internet Explorer 3+

  • Apple Safari 1+

  • Opera 3.5+

For further reading

Please refer to the following tutorials:CSS text,CSS margin.

Text-related attributes:letter-spacing,text-align,text-decoration,text-overflow,text-shadow,text-transform,white-space,word-spacing.