Indent the first line of a paragraph in CSS


Use the text-indent property to indent the first line of a paragraph. Possible values are % or a number specifying indent space.

Example

You can try to run the following code to indent the first line:

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

Lakshmi Srinivas
Lakshmi Srinivas

Programmer / Analyst / Technician

Updated on: 31-Jan-2020

3K+ Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements