CSS/Properties/text-indent

From W3C Wiki
Jump to: navigation, search

text-indent

The text-indent property specifies the indentation of the first line of text in a block container.

Description

Values <length> | <percentage> | inherit
Initial value 0
Applies to block containers
Inherited Yes


Point, Note

  • This property only affects a first line of an element.


Values

  • <length>
    The indentation is a fixed length.


  • <percentage>
    The indentation is a percentage of the containing block width.


  • inherit
    Takes the same specified value as the property for the element's parent.


Example

Example A

[style.css]

 p {
   width: 300px;
   border: 1px solid black;
   text-indent: 1em;
 }

[index.html]

  <body>
    <p>CSS is a Style Sheet Language for formatting the document content 
       (written in HTML or other markup language). You might be interested 
       by the CSS Working Group wiki too.</p>
  </body>

Csslist2 text-indent.png

CSS Reference

The CSS specification defines the text-indent property in 16.1 Indentation.