text-indent - HTML CSS CSS Property

HTML CSS examples for CSS Property:text-indent

Description

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.

Syntax

The syntax of the property is as follows:


text-indent:      length | percentage | initial | inherit

Property Values

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.
initialSets this property to its default value.
inherittake the value of its parent element text-indent property.

The example below shows the text-indent property.

Demo Code

ResultView the demo in separate window

<!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>

Related Tutorials