CSE 154 Examples

Text Indent Property

The Text Indent property can be used to set the indentation of the first line of any text.

Description

The text-indent property can be specified in many ways.

  • Length - The text-indent can be set to a specific value specified in px, pt, em, etc.
  • Percentage - The text-indent can be set to a specific percentage specified in % of the parent element.
  • Initial - Text-indent is set to it's default value (usually 0).
  • Inherit - Text-indent is inherited from the parent element.

Syntax :

                  
                      element {
                        text-indent: 15pt;
                      }

                      p {
                        text-indent: 20%;
                      }
                  
                

HTML :

CSS :

Live Preview :