在 html 中实现段落前空两格的方法有:使用 实体使用 text-indent 样式使用 css tab 属性直接插入 tab 字符

段落前空两格
在 HTML 中,可通过以下方法实现段落前空两格:
使用 实体
实体表示一个非空格字符,但浏览器会将其渲染为一个空格。要空两格,可以使用两个连续的 实体:
<code class="html"><p> 段落内容</p></code>
使用 text-indent 样式
text-indent 样式属性定义段落首行的缩进。要空两格,可将 text-indent 设置为 2 个 em:
<code class="html"><p style="text-indent: 2em;">段落内容</p></code>
使用 CSS tab 属性
tab 属性定义字符之间的制表位位置。要空两格,可设置 tab-size 为 2 个空格:
<code class="css">p {
tab-size: 2;
}</code>
将 tab 字符插入 HTML
可直接在 HTML 源代码中插入 tab 字符:
<code class="html"><p> 段落内容</p></code>
其中, 表示一个 tab 字符。
在选择方法时,根据具体情况选择最方便、兼容性最好的方法。
原文来自:www.php.cn© 版权声明
文章版权归作者所有,未经允许请勿转载。
THE END





















































暂无评论内容