CSS text indent is used to define the indentation of paragraphs.
The indentation given to the content gives margin to the first line of content from the start.
Syntax
1 |
text-indent: enter value for indenttation |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
<style> .div-indent{ border:1px solid yellow; border-radius:20px; padding:10px; } p.indent-para{ text-indent:10px; } </style> <div class="div-indent"> <p class="indent-para">This is indented paragarph.</p> <p>This is not an indented paragraph.</p> </div> |
Output
This is indented paragarph.
This is not an indented paragraph.
CSS text indent values list
Sr. No. | value | Description |
---|---|---|
1 | length | Used to give the indentation in px, cm, em etc. The value for this for example can be 10px. |
2 | percentage | Used to give the indentation in percentage. The value for this for example can be 20%. |
3 | initial | Used to define as the property initial value. |
4 | inherit | Used to define the computed value of property on the elements parent. |
5 | unset | Used to define the property either acts as inherit or initial, depending on the property if it is inherited or not. |