HTML | DOM Style textIndent Property
The DOM Style textIndent Property is used for indentation of the first line in each block of text. It also takes negative values. If the value is negative then the first line will be indented to the left.
- It is used to set the textIndent property:
object.style.textIndent = "length|%|initial|inherit"
- It is used to get the textIndent property:
- length: It is used to set fixed indentation in terms of px, pt, cm, em etc. The default value of length is 0.
- percentage (%): It is used to define the indentation in % as compared to the width of the element.
- initial: It is used to set text-indent property to its default value.
Return Value: It returns a string value which represent the indentation of the first line in each block of text.
- Before clicking on the button :
- After clicking on button :
Example-2: To get the value of text-indent.
- Before clicking on the button:
- After clicking on the button:
Supported Browser: The browser supported by DOM Style textIndent are listed below:
- Google Chrome
- Internet Explorer
Attention reader! Don’t stop learning now. Get hold of all the important Comcompetitivepetitve Programming concepts with the Web Design for Beginners | HTML course.