Text Indentation using CSS

CSSWeb DevelopmentFront End Technology

For text indentation, use the text-indent property in CSS. This is for the indentation of the first line in a paragraph.

Example

Let us now see an example −

 Live Demo

<!DOCTYPE html>
<html>
<head>
<style>
div {
   text-indent: 30px;
}
</style>
</head>
<body>
<h1>Demo Heading</h1>
<div>
<p>This is demo text. This is demo text. This is demo text. This is demo text. This is demo text. This is demo text. This is demo text. This is demo text.
</p>
</div>
</body>
</html>

Output

Example

Let us now see another example −

 Live Demo

<!DOCTYPE html>
<html>
<head>
<style>
div {
   text-indent: 15em;
}
</style>
</head>
<body>
<h1>Demo Heading</h1>
<div>
<p>This is demo text. This is demo text. This is demo text. This is demo text. This is demo text. This is demo text. This is demo text. This is demo text.
</p>
</div>
</body>
</html>

Output

raja
Published on 30-Dec-2019 17:15:47
Advertisements