Text indentation can also be manipulated by CSS by using the text-indent property. The text-indent property is applied to a paragraph or any other element and it inserts the given length before the first line of text, thus indenting the text. Its usage is as
.top
{ text-indent: 2em; }
{ text-indent: 2em; }
Its values are discussed as
Value |
Description |
Normal |
Defines a fixed indentation in px, pt, cm, em, etc. |
% |
Defines the indentation in % of the width of the parent element |
The percentage width assigned by the text-indent property depends on the width of the element’s parent.
Percentage values are not used widely as with cascading it becomes complex to know the value. It can also accept a negative value then the text will be shifted to the outside of the text, to the left.