The text-indent property sets empty space before lines of text in a block container, at the inline-start edge of the content box. By default that indents the first line.
It is inherited. The initial value is 0. Use a length or percentage, and optionally add hanging and/or each-line.
Notehanging / each-line need modern browsers
Length and percentage indent are universal. The hanging and each-line keywords are newer—check support before relying on them in production.
First line stays left. Following lines are pushed in by 2em when hanging is supported.
Not the same as a negative indent, which outdents the first line.
How It Works
Keep a positive length.2em is the indent distance.
Add hanging. That inverts which lines get indented.
First line stays put. All other lines move inward.
Check support. Older browsers may ignore the keyword and only apply 2em to the first line.
Edge Cases & Pitfalls
If the indent looks wrong, one of these is usually why.
block
Applies to block containers
Inline elements do not create the lines that text-indent targets. Use it on block-level boxes.
%
Percentages use content width
The base is the container’s inner inline size. Padding and border are excluded.
negative
Negative ≠ hanging
A negative value outdents the first line. hanging leaves the first line and indents the rest.
keywords
hanging / each-line are newer
Without support, browsers may fall back to a plain length indent on the first line only.
margin
Not the same as margin or padding
Those shift the whole box. text-indent only shifts text lines inside the content box.
Compatibility
Browser Support
text-indent is a browser layout property. Node.js, Deno, and Bun do not apply it.
✓ Baseline · Length/% universal
text-indent
Length and percentage values work everywhere. hanging and each-line need modern browsers (Safari 15+, Firefox 121+, recent Chromium).
99%Length & percentage
Google ChromeAll / 146+ keywords
Full
Mozilla FirefoxAll / 121+ keywords
Full
Apple SafariAll / 15+ keywords
Full
Microsoft EdgeAll / 146+ keywords
Full
OperaAll / 131+ keywords
Full
Samsung InternetLength/%
Partial
Internet ExplorerLength/%
Partial
text-indentWidely supported
Bottom line: Safe for classic first-line indents everywhere. Treat hanging and each-line as progressive enhancement.
Remember
Key Takeaways
Role: add empty space before text lines at the inline-start edge.
Common values:2em, 40px, or a percentage of the content width.
Initial value:0. Inherited. Applies to block containers.
Keywords:hanging and each-line are optional and newer.
One line:text-indent is the classic first-line paragraph indent—with optional hanging and each-line modes.
Frequently Asked Questions
It sets empty space before lines of text in a block container, at the inline-start edge. By default that means indenting the first line.
The initial value is 0, so no indentation is applied.
A percentage is relative to the block container's inner inline size (the content width), not including padding or border.
A negative length outdents the first line into the padding or beyond. hanging keeps the first line flush and indents every other line instead.
each-line indents the first line and each line after a forced break (like a line feed). Soft-wrapped lines are not indented again.
Length and percentage indent are supported in all major browsers, including Internet Explorer. The hanging and each-line keywords are newer and need modern browsers. It is a browser layout property, not a Node.js feature.