Language
日本語
English

Caution

JavaScript is disabled in your browser.
This site uses JavaScript for features such as search.
For the best experience, please enable JavaScript before browsing this site.

CSS Dictionary

  1. Home
  2. CSS Dictionary
  3. text-indent

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

ValueDescription
numberA 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

Chrome Chrome
1+
Firefox Firefox
1+
Safari Safari
1+
Edge Edge
12+
Supported in all versions
IE IE
11
10
9
8
7
6
Opera Opera
3.5+
2 and earlier ×
iOS Safari iOS Safari
1+
Android Android Browser
4.4+
3 and earlier ×
Chrome Android Chrome Android
Latest
Same support as desktop
Firefox Android Firefox Android
Latest
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 .