Name

text-indent — NN 4 IE 4 CSS 1

Synopsis

Inherited: Yes

Sets the size of indenting of the first line of a block of inline text (such as a P element). Only the first line is affected by this setting. A negative value can be used to outdent the first line, but be sure the text does not run beyond the left edge of the browser window or frame.

CSS Syntax

text-indent: length | percentage

JavaScript Equivalent

textIndent

Value

See the discussion about length values at the beginning of this chapter. Negative lengths may be allowed in some contexts, but be sure to test the results on all browsers. You may also specify a percentage value, which is calculated based on the width of the next outermost container.

Initial Value

0

Example

BODY {text-indent: 2em}
P.firstGraphs {text-indent: 0}

Applies To

Block-level elements.

Object Model Reference

IE

[window.]document.all.elementID.style.textIndent

Notes

Internet Explorer 4 for the Macintosh does not respond to the text-indent attribute properly.

Get Dynamic HTML: The Definitive Reference now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.