用CSS完成文字上下对齐且首行缩进的编码

2021-03-13 04:55 jianzhan

先看实际效果图吧:

其源码就较为整洁了,源代码以下:

拷贝编码
编码以下:

<p class="elegant">Our online order form allows you to order directly in the internet, saving your time and offering you convenience. Here’s how you do it.</p>
<p class="elegant">When you want to buy our commodities, please register first. After you create your account successfully, you can directly order our products and pay for them. Next time you just click “log in”, you can enter your account, then shopping simply and conveniently.</p>

最关键的便是CSS了,编码以下:

拷贝编码
编码以下:

<style type="text/css">
*.elegant
{
margin-left: 40px;
margin-right: 80px;
letter-spacing: 1px;
word-spacing: 2px;
line-height: 1.7em;
text-indent: 40px;
text-align: justify;
}
</style>

上面简易的CSS款式就完成了文字的上下对齐,而且段落的首行是缩进的.