文本缩进

使用text-align属性表示文本缩进,其中属性值为负值向左移动,正值表示向右移动

示例:

 1 <!DOCTYPE html>
 2 <html lang="en">
 3 <head>
 4     <meta charset="UTF-8">
 5     <title>文本缩进</title>
 6     <style type="text/css">
 7         h1 {
 8             background-image: url("images/logo.gif");
 9             background-repeat: no-repeat;
10             text-indent: -9999px;
11             width: 165px;
12             height: 100px;
13         }
14 
15         .credits {
16             text-indent: 20px;
17         }
18     </style>
19 </head>
20 <body>
21 <h1>Briards</h1>
22 <p class="credits">by Ivy Duckett</p>
23 <p class="intro">The <a class="breed" href="http://en.wikipedia.org/wiki/Briard">briard</a>, or berger de brie, is a
24     large breed of dog traditionally used as a herder and guardian of sheep.</p>
25 <h2>Breed History</h2>
26 <p>The briard, which is believed to have originated in France, has been bred for centuries to herd and to protect sheep.
27     The breed was used by the French Army as sentries, messengers and to search for wounded soldiers because of its fine
28     sense of hearing. Briards were used in the First World War almost to the point of extinction. Currently the
29     population of briards is slowly recovering. Charlemagne, Napoleon, Thomas Jefferson and Lafayette all owned
30     briards.</p>
31 </body>
32 </html>

原文地址:https://www.cnblogs.com/qq3069418554/p/9164718.html