The text-indent property defines an indentation distance for the first line of text in a block-level element.
length − Any length value. Negative lengths are permitted for the property, and will produce a "hanging indent" effect.
percentage − The first line of text is indented by a distance relative to the width of the element's containing block.
All the block-level elements.
object.style.textIndent = "20px";
Following is the example which demonstrates how to indent the first line of a paragraph −
<html> <head> </head> <body> <p style = "text-indent:1cm;"> This text will have first line indented by 1cm </p> <p style = "text-indent:1cm;"> this line will remain at its actual position this is done by CSS text-indent property. </p> </body> </html>
This will produce following result −