PHP前端开发

html如何让段落空两个距离

百变鹏仔 4周前 (09-21) #HTML
文章标签 距离
有三种方法可在 html 中缩进段落:使用 css 中的 text-indent 属性、使用 html 缩进元素(即 或 )或在某些情况下使用 indent 属性(但后者并非所有浏览器都支持)。

如何在 HTML 中为段落添加两个缩进

方法 1:使用文本缩进属性

在 CSS 中,可以使用 text-indent 属性为段落添加缩进:

<style>p {  text-indent: 2em;  /* 设置缩进为 2 个 em */}</style><p>段落内容</p><p><span>立即学习</span>“<a href="https://pan.quark.cn/s/cb6835dc7db1" style="text-decoration: underline !important; color: blue; font-weight: bolder;" rel="nofollow" target="_blank">前端免费学习笔记(深入)</a>”;</p>

方法 2:使用 HTML 缩进元素

可以使用

或 元素来创建缩进段落:
<blockquote cite="出处">  <p>段落内容</p><p><span>立即学习</span>“<a href="https://pan.quark.cn/s/cb6835dc7db1" style="text-decoration: underline !important; color: blue; font-weight: bolder;" rel="nofollow" target="_blank">前端免费学习笔记(深入)</a>”;</p></blockquote>

或:

<indent><p>段落内容</p><p><span>立即学习</span>“<a href="https://pan.quark.cn/s/cb6835dc7db1" style="text-decoration: underline !important; color: blue; font-weight: bolder;" rel="nofollow" target="_blank">前端免费学习笔记(深入)</a>”;</p></indent>

方法 3:使用 HTML 缩进属性

在某些情况下,可以使用 indent 属性直接缩进段落:

<p indent="2">段落内容</p>

然而,这个属性在所有浏览器中都不受支持。