text-indent
Specifies the indentation width of the first line of text.
Sample Code
p.test { text-indent: 0;}
p.test1 { text-indent: 10px;}
p.test2 { text-indent: 1em;}
p.test3 { text-indent: 5%;}
p.test4 { text-indent: -10px;}
Available Values
| Value | Description |
|---|---|
| number | A numeric value. Supported units include 'px', 'em', and '%'. Negative values are also allowed. The initial value is '0'. |
Browser Display Result
<p style="text-indent: 0; border: solid 1px black; width: 400px; margin: 0 auto;">This is a p element. Once upon a time, there was a married couple who had long wished for a child. At last their wish was granted. Behind their house was a small window, beyond which lay a beautiful garden full of flowers and vegetables. The garden was surrounded by high walls, and its owner was a terribly powerful witch, feared by all the world, so no one dared to enter.</p>
<p style="text-indent: 100px; border: solid 1px black; width: 400px; margin: 0 auto;">This is a p element. Once upon a time, there was a married couple who had long wished for a child. At last their wish was granted. Behind their house was a small window, beyond which lay a beautiful garden full of flowers and vegetables. The garden was surrounded by high walls, and its owner was a terribly powerful witch, feared by all the world, so no one dared to enter.</p>
<p style="text-indent: 1em; border: solid 1px black; width: 400px; margin: 0 auto;">This is a p element. Once upon a time, there was a married couple who had long wished for a child. At last their wish was granted. Behind their house was a small window, beyond which lay a beautiful garden full of flowers and vegetables. The garden was surrounded by high walls, and its owner was a terribly powerful witch, feared by all the world, so no one dared to enter.</p>
<p style="text-indent: 10%; border: solid 1px black; width: 400px; margin: 0 auto;">This is a p element. Once upon a time, there was a married couple who had long wished for a child. At last their wish was granted. Behind their house was a small window, beyond which lay a beautiful garden full of flowers and vegetables. The garden was surrounded by high walls, and its owner was a terribly powerful witch, feared by all the world, so no one dared to enter.</p>
<p style="text-indent: -20px; border: solid 1px black; width: 400px; margin: 0 auto;">This is a p element. Once upon a time, there was a married couple who had long wished for a child. At last their wish was granted. Behind their house was a small window, beyond which lay a beautiful garden full of flowers and vegetables. The garden was surrounded by high walls, and its owner was a terribly powerful witch, feared by all the world, so no one dared to enter.</p>
Browser Compatibility
Desktop
Supported in all versions
8 ○
7 ○
6 ○
2 and earlier ×Mobile
Android Browser
4.4+ ○
3 and earlier ×Same support as desktop
Same support as desktop
※ Version data is based on MDN.
Details
Specifies the indentation width of the first line of text. Negative values are also allowed.
When the unit is specified as '%', it is a relative value based on the width of the element's own content block.
If you find any errors or copyright issues, please contact us.