Text-indent

The Text-indent property of CSS is used to set any first line’s indentation inside a text’s block. It describes the horizontal space amount that puts establish before the text line.

It also allows the negative values in CSS. When the negative values are specified, the first line’s indentation will be to the life side.

Syntax:

Property Values

length: The length specified above is used to set the fixed indentation along with some units like px, em, pt, cm, and many others. It has a default value of 0. Also, it permits negative values. If its values are negative, then the first line’s indentation will be on the left side.

percentage: It describes the amount inside the space within the width percentage of any containing block.

initial: It can be used to set the attribute to its default attribute. This property value contains two other experimental attributes, which are explained below. The following two values are not supported inside the browsers.

hanging: This value is experimental and unofficial value. It inverts any indented line. Except for the first line, it can indent all the lines. The bibliographies are usually mentioned along with this value, in which any first line will be with a left-hand side margin, and other contents are indented.

each-line: These property values are also the experimental values. This value can influence all the lines and the first line afterward, the affected line break (with the use of <br>).

Example:

In the following example, we apply the CSS text-indent property along with some length values like cm, em, and px. Also, we are using the CSS text-align: justify; property to find the exceptional results.

Output:

CSS Text-indent

Example:

Let’s take another illustration with the use of some percentage values.

Output:

CSS Text-indent

Pin It on Pinterest

Share This