text-indent

Sets the indentation of the first line of text in the object.

Syntax

{ text-indent: sIndent }

Possible values

sIndent

Variant that specifies one of the following values:

percentage

Integer, followed by a percent sign (%). This value is a percentage of the width of the parent object.

length

Floating-point number, followed by an absolute units designator (cm, mm, in, pt, or pc) or a relative units designator (em, ex, or px).

The property has a default value of 0. It is inherited.

Remarks

The property can be negative. An indent is not inserted in the middle of an object that was broken by another object, such as the BR element in the HTML element.

Examples

The following example uses the text-indent property to indent the text of the object. This example uses calls to an embedded style sheet to change the indent on the text when an onclick event occurs. The text was originally indented 2 centimeters using the DIV element as a selector in the style sheet:

<style>
    div {text-indent:2cm}
    .click1 {text-indent:50%}
    .click2 {text-indent:}
</style>
</head>
<body>
<div onclick="this.className='click1'"
    ondblclick="this.className='click2'">
. . . </div>

Standards information

This property is defined in Cascading Style Sheets (CSS), Level 1 (CSS1) Ee371258.xtlink_newWindow(en-us,Expression.40).png.

Applies to

blockquote, body, button, center, dd, dfn, div, dl, dt, fieldset, form, hn, hr, li, ol, p, table, td, th, tr, ul, xmp

See also

Concepts

padding
margin
vertical-align

Send feedback about this topic to Microsoft. © 2011 Microsoft Corporation. All rights reserved.