HTML CSS examples for CSS Property:text-indent
The text-indent CSS property specifies the indent in the first line of text.
The following table summarizes the text-indent Property.
Item | Value |
---|---|
Default value: | 0 |
Applies to: | Block and inline-block elements, table cells |
Inherited: | Yes |
Animatable: | Yes. |
The syntax of the property is as follows:
text-indent: length | percentage | initial | inherit
The following table describes the values of this property.
Value | Description |
---|---|
length | a fixed length indentation. Negative length Values are allowed. |
percentage | sets indentation as a percentage (%) of the containing block width. Negative percentage Values are allowed. |
initial | Sets this property to its default value. |
inherit | take the value of its parent element text-indent property. |
The example below shows the text-indent property.
<!DOCTYPE html> <html lang="en"> <head> <title>Example of CSS text indentation</title> <style type="text/css"> p {<!--from ww w. jav a 2 s .com--> text-indent: 100px; } </style> </head> <body> <h1>Text-indentation Effect</h1> <p>This is a test. This is a test. This is a test. This is a test. This is a test. This is a test. This is a test. This is a test. This is a test. This is a test. This is a test. This is a test. This is a test. This is a test. This is a test. This is a test. This is a test. This is a test. This is a test. This is a test. This is a test. This is a test. </p> </body> </html>