CSS text-indent
The CSS text-indent
property specifies the indentation applied to lines of inline content in a block.
When using the text-indent
property, the indent is treated as a margin applied to the start edge of the line box. Only lines that are the first formatted line of an element are affected (unless otherwise specified via the each-line
and/or hanging
keywords).
Syntax
Possible Values
- length
- This value specifies an absolute length as the amount of the indent.
- percentage
- This value specifies the amount of the indent as a percentage of the containing block's logical width.
each-line
- Indentation affects the first line of the block container as well as each line after a forced line break, but does not affect lines after a soft wrap break.
hanging
- Inverts which lines are affected.
In addition, all CSS properties also accept the following CSS-wide keyword values as the sole component of their property value:
initial
- Represents the value specified as the property's initial value.
inherit
- Represents the computed value of the property on the element's parent.
unset
- This value acts as either
inherit
orinitial
, depending on whether the property is inherited or not. In other words, it sets all properties to their parent value if they are inheritable or to their initial value if not inheritable.
General Information
- Initial Value
0
- Applies To
- Block containers
- Inherited?
- Yes
- Media
- Visual
- Animatable
- Yes (see example)
Example Code
Official Specifications
- CSS Text Module Level 3 (W3C Last Call Working Draft 10 October 2013)
- CSS Level 2.1 (W3C Recommendation 07 June 2011)
- CSS Level 1 (W3C Recommendation 17 Dec 1996)