Export (0) Print
Expand All

text-indent

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

{ text-indent: sIndent }

sIndent

Variant that specifies or receives 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.

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.

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>

BLOCKQUOTE, BODY, BUTTON, CENTER, DD, DFN, DIV, DL, DT, FIELDSET, FORM, HN, HR, LI, OL, P, TABLE, TD, TH, TR, UL, XMP

Community Additions

ADD
Show:
© 2014 Microsoft