text-indent property (Internet Explorer)

Switch View :
ScriptFree
text-indent property

[This documentation is preliminary and is subject to change.]

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

This property is not supported for Metro style apps using JavaScript.

CSS 2.1, Section 5.4.7

Syntax

text-indent: <length> | <percentage> | inherit

Property values

A Variant that specifies or receives one of the following values:

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).

percentage

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

inherit

CSS information

Applies ToAll elements
Mediavisual
Inherited1
Initial Value0

Standards information

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 br in HTML.

Examples

The following examples use the text-indent attribute and the text-indent property to indent the object's text.

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 div as a selector in the style sheet.

Code example: http://samples.msdn.microsoft.com/workshop/samples/author/dhtml/refs/text-indent.htm


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

This example uses inline scripting to indent the text within the div when an onmouseover event occurs.

Code example: http://samples.msdn.microsoft.com/workshop/samples/author/dhtml/refs/textIndent.htm


<DIV onmouseover=this.style.textIndent="2cm"
:
</DIV>

 

 

Build date: 3/14/2012

Community Content

Naveen Manjunath
text-indent and word-spacing
Sometimes text-indent does not work properly on IE and works good on other browsers (For e.g. watermark text). Even word-spacing  needs to be specified. For e.g.
{
text-indent:5px;
word-spacing:0px;
}

Thomas Lee
Possible Values - 'null'
CORRECTION:

The default value is 0 for currentStyle, only; whereas--
The default value is null for style, runtimeStyle.