The text-indent property
The CSS text-indent property is used to indent the first line of the specified text. If this is a paragraph, only the first line will be indented by the given px, pt or % etc.
The positive value given in the text-indent CSS property will indent to the right. If a negative value is given, it will be indented towards the left.
Example of using text-indent property
The following is a CSS indent example. The example indents the multi-line paragraph <p> to specified value in pixels.
Experience this example online
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
|
<html>
<head>
<style>
/*CSS text properties*/
p
{
background-color: #F0F0F0;
color: #3355bb;
text-indent:50px;
}
</style>
</head>
<body>
<p>This is text indent chapter by using text-indent property! <br />
This is text indent chapter by using text-indent property! <br />
This is text indent chapter by using text-indent property!
</p>
</body>
</html>
|
You can see, the paragraph text is indented 50px by using the text-indent property.
Also see CSS line-height | CSS text
Leave A Comment?