CSS Property text-indent








This can be used to create a tab effect. Negative values are permitted and cause outdent effects.

Summary

ItemValue
Initial value 0
Inherited Yes.
Version
JavaScript syntax
Applies to Block-level elements.




CSS Syntax

text-indent: length | percentage | inherit 

Property Values

The property values are listed in the following table.

ValueDescription
auto Default value. The browser does the calculation.
length Set width in px, cm, etc.
% Set width in percent of the containing element
inherit Inherit the width property from the parent element

Browser compatibility

Yes Yes Yes Yes Yes




Example

An example showing how to use text-indent CSS property.

<!DOCTYPE HTML>
<html>
    <head>
        <style>
            p {<!--from   w  w  w .  ja v a2 s.c  o m-->
                text-indent: 25%;
                width: 200px;
            }
        </style>
    </head>
<body>
    <p>
       This is a test. This is a test. This is a test. This is a test. 
    </p>
</body>
</html>

Click to view the demo