Get to know MDN better
This feature is well established and works across many devices and browser versions. It’s been available across browsers since July 2015.
* Some parts of this feature may have varying levels of support.
The text-indent CSS property sets the length of empty space (indentation) that is put before lines of text in a block.
Indentation is specified as an absolute <length>. Negative values are allowed. See <length> values for possible units.
<percentage>Indentation is a <percentage>. The percentage is relative to the container's own inner inline size.
each-lineIndentation 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.
hangingInverts which lines are indented. All lines except the first line will be indented.
The text-indent CSS property sets the length of empty space (indentation) that is put before lines of text in a block container. The indentation set by the property occurs at the inline-start edge of the content box. The value is a <length-percentage>, optionally with one or both of the keywords each-line and/or hanging. The initial value is 0.
Percent values are relative to the block container's inline-axis inner size, which is the dimension of the content-area only, excluding the container's padding and border.
The <length-percentage> can be a positive or negative value. A negative value creates an outdent equal to the absolute value of the <length-percentage> equivalent positive value. A negative value effectively pushes the text the size of the value, but in the opposite direction. For example, text-indent: 3%; indents the first line of text, adding white space that is 3% of the container's inner-size before the text, pushing the first line of content toward the inline-end direction. Setting text-indent: -3% outdents the first line of text, pushing the start of the first line of text 3% of the container's inner-size past the inline-start of the content area, into the padding and border, possibly overflowing the container.
A negative value is different from adding the hanging keyword to a positive value. Continuing with the same example, text-indent: 3% hanging doesn't outdent the first line of text. Rather, it indents all the lines of text except the first line, by 3% of the container's inner-size.
| 0 |
| block containers |
| yes |
| refer to the width of the containing block |
| the percentage as specified or the absolute length, plus any keywords as specified |
| a length, percentage or calc(); |
This example demonstrates the basic usage of the text-indent property.
We include two paragraphs of text.
We use the text-indent property to indent the first line of each paragraph by 5em.
Using the same HTML as in the previous example, here we demonstrate using percentage values and how percentage values are relative to the element's content area in the inline direction.
We set the text-indent to a percentage value. We also added padding and vertical stripes to better enable gauging the size of the indentation relative to the element's box model.
A common typographic practice when paragraph indentation is present is to skip the indentation for the first paragraph. As The Chicago Manual of Style puts it, "the first line of text following a subhead may begin flush left or be indented by the usual paragraph indention."
Treating first paragraphs differently from subsequent paragraphs can be done using the next-sibling combinator, as in the following example:
| CSS Text Module Level 3 # text-indent-property |
Enable JavaScript to view this browser compatibility table.
This page was last modified on Apr 20, 2026 by MDN contributors.
Your blueprint for a better internet.
Visit Mozilla Corporation’s not-for-profit parent, the Mozilla Foundation.
Portions of this content are ©1998–2026 by individual mozilla.org contributors. Content available under a Creative Commons license.