Arrow

CSS Text Indent

AuthorHariom Prajapati

Pubish Date24 Oct 2022

categoryCSS

It is use to specify the distance from where the first line will be start.

 

Syntax -

text-indent: value;

 

values

length

Set text indent value in px, pt, cm, etc.

%

Set text indent value in percent.

Note:- Negative values are allowed.

 

For example -

<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Text Indent</title>

  <style>
    .em {
      text-indent: 3em;
    }

    .px {
      text-indent: 100px;
    }

    .pt {
      text-indent: 15pt;
    }

    .cm {
      text-indent: 1cm;
    }

    .percent {
      text-indent: 50%;
    }
  </style>
</head>

<body>
  <p class="em">Web design refers to the design of websites that are displayed on the internet. It usually refers to the user experience aspects of website development rather than software development.</p><br>
  <p class="px"> Web design refers to the design of websites that are displayed on the internet. It usually refers to the user experience aspects of website development rather than software development.</p><br>
  <p class="pt">Web design refers to the design of websites that are displayed on the internet. It usually refers to the user experience aspects of website development rather than software development.</p><br>
  <p class="cm"> Web design refers to the design of websites that are displayed on the internet. It usually refers to the user experience aspects of website development rather than software development.</p>
  <p class="percent">Web design refers to the design of websites that are displayed on the internet. It usually refers to the user experience aspects of website development rather than software development.</p>
</body>

</html>

 

Output

CSS text indent