CSS - text-indent Property
The text-indent property sets the indentation of the first line of the text, i.e., the distance of the first line of text in a block-level element from the margin.
Possible Values
length: Any specific length {pixels (px), points (pt), ems (em), etc}. Default value is 0.
percentage (%): The value passed is in relation to the percentage of the width of the parent element.
initial: Sets the text-indent to its default value.
inherit: Allows to inherit the text-indent value from its parent element.
Applies to
All the block-level elements.
DOM Syntax
object.style.textIndent = "20px";
CSS text-indent - Basic Example
Here is an example:
<html>
<head>
</head>
<body>
<h2>Text indentation</h2>
<p style="text-indent: 2cm;">Text indentation at 2 cm.</p>
<p style="text-indent: 2in;">Text indentation at 2 inches.</p>
<p satyle="text-indent: 20%;">Text indentation at 20%.</p>
</body>
</html>
Advertisements