text-indent
The indent of the first line of a block.
Syntax
text-indent: value;Values
| Parameter | Type | Description |
|---|---|---|
| length | length | The indent size: `2em`, `20px`; a negative value pulls the line out. |
| % | percentage | A percentage of the block width. |
Examples
Book-style paragraph indents:
<style>
p { text-indent: 2em; margin: 0; max-width: 320px; }
</style>
<p>The first line of each paragraph starts with an indent, as in printed books.</p>
<p>The second paragraph is indented in the same way.</p>Notes
Indents and gaps between paragraphs do the same job, so books usually use one or the other, not both.
See also
- text-align — Horizontal alignment of text and inline content inside a block.
- padding — The inner spacing between the content and the border of an element.
In the tutorial
- Text and fonts — Font family, size, weight, italics, line height, alignment and text decoration, plus loading your own font.