用CSS如何实现文本左右对齐且首行缩进的代码

困难是动摇者和懦夫掉队回头的便桥;但也是勇敢者前进的脚踏石。我不识何谓君子,但看每事肯吃亏者便是;我不识何谓小人,但看每事好占便宜者便是。

先看效果图吧:

其源代码就比较干净了,源码如下:

复制代码
代码如下:

<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样式就实现了文本的左右对齐,并且段落的首行是缩进的.

本文用CSS如何实现文本左右对齐且首行缩进的代码到此结束。爱是一种奇怪的东西,忽闪忽灭间的深刻,成长在彼此心里。最美丽的故事没有结局,最浪漫的感情没有归宿,最幸福的爱情没有言语,最深刻的喜欢没有空间!小编再次感谢大家对我们的支持!

您可能有感兴趣的文章
css让页脚保持在底部位置的四种方案

CSS如何使用Flex和Grid布局如何实现3D骰子

Flex布局史上最简单使用语法教程

新的CSS 伪类函数 :is() 和 :where()示例详解

纯CSS打字动画的如何实现示例