要让CSS实现两段文字分别首行缩进,需要使用textindent属性。这个属性可以设置段落开始的缩进量,以像素或em为单位。以下是示例代码: p { textindent: 2em; } 这段代码会让...
要让CSS实现两段文字分别首行缩进,需要使用text-indent属性。这个属性可以设置段落开始的缩进量,以像素或em为单位。以下是示例代码:
p {
text-indent: 2em;
} p.first {
text-indent: 1em;
}
p.second {
text-indent: 2em;
} <p class="first">这是第一段文字,首行缩进1个em。</p>
<p class="second">这是第二段文字,首行缩进2个em。</p>