如何在 <br> 标签中添加空间

3

在一个主要的<p>标签内,我有很多<br />标签。

我想增加由<br>(例如上下边距)创建的视觉空间。

<p>
Some text here<br />
Some other text<br />
Some other text
</p>

我可以使用不同的 <p> 标签,但在我的网站上必须按这种方式进行。

有什么办法可以增加 <br> 创建的间距吗?非常感谢。

4个回答

4
请查看CSS中的line-height属性。
示例:
p { line-height: 90%; }

1
抱歉,各位,但我只需要在 <br> 前后创建空格,而不是在每行的 <p> 中都创建。有什么想法吗? - GibboK
1
将您想要包装的行与span或其他内容一起使用,并将行高应用于该内容。 - Bas Slagter

1

If you no want to use css, try of this code. when you use style with

of Html file the javascript programming will be prefer your order in Html file instead of same class inside the file of css.

<p style="line-height: 2.7">
Some text here<br />
Some other text<br />
Some other text
</p>

<p style="margin-top: 3.5em">
Some text here<br />
Some other text<br />
Some other text
</p>

<p style="line-height: 0.6; margin-top: 7.0em">
Some text here<br />
Some other text<br />
Some other text
</p>

I hope my answer helped for your question.

best regards,

Wahab


0
你需要使用 line-height 属性。
p {line-height:70px}

1
请在 <br> 前后创建空格,而不是在每行 <p> 中都创建空格。你能帮忙吗?谢谢。 - GibboK

0

我认为br标签只是用于换行,没有其他作用。为什么要尝试编写一种绕过的代码呢?如果您无法使用任何建议的答案,我建议您只使用多个br标签。


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接