Indent the first line of a <div> element with 50 pixels:
The textIndent property sets or returns the indentation of the first line of text.
Note: Negative values are allowed. The first line will be indented to the left if the value is negative.
The textIndent property is supported in all major browsers.
Return the textIndent property:
Set the textIndent property:
Value | Description |
---|---|
length | Defines the indentation in length units. Default value is 0 |
% | Defines the indentation in % of the width of the parent element |
initial | Sets this property to its default value. Read about initial |
inherit | Inherits this property from its parent element. Read about inherit |
Default Value: | 0 |
---|---|
Return Value: | A String, representing the indentation of the first line of text in the element |
CSS Version | CSS1 |
Return the text indentation of a <div> element:
CSS tutorial: CSS Text
CSS reference: text-indent property