Tutorials Point


  CSS Home

  CSS Reference
  Pseudo Classes & Elements

Copyright © 2014 by tutorialspoint



  Home     References     Discussion Forums     About TP  

CSS - text-indent


previous next AddThis Social Bookmark Button


Advertisements

Description:

The text-indent property defines an indentation distance for the first line of text in a block-level element.

Possible Values:

  • length: Any length value. Negative lengths are permitted for the property, and will produce a "hanging indent" effect.
  • percentage: The first line of text is indented by a distance relative to the width of the element's containing block.

Applies to:

All the block-level elements.

DOM Syntax:

object.style.textIndent="20px";

Example:

Following is the example which demonstrates how to indent the first line of a paragraph:

<p style="text-indent:1cm;">
This text will have first line indented by 1cm
and this line will remain at its actual position
this is done by CSS text-indent property.
</p>

This will produce following result:

This text will have first line indented by 1cm
and this line will remain at its actual position
this is done by CSS text-indent property.

To Become more comfortable - Do Online Practice



previous next Printer Friendly

Advertisements


  

Advertisements