Html 如何标记多个<br />?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/10249753/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-28 23:55:02  来源:igfitidea点击:

How to mark up multiple <br />?

asp.nethtml

提问by RJIGO

I use

我用

  <br />

to insert blank lines on my webpage. What is an elegant way to do the equivalent of 20 - 40 of these? After formatting, each br tag is put on a separate line which make reading the file cumbersome.

在我的网页上插入空行。完成其中 20 - 40 次的优雅方法是什么?格式化后,每个 br 标签都放在一个单独的行上,这使得读取文件很麻烦。

回答by devdRew

min-height, marginand padding.

min-heightmarginpadding

You can define CSS styles for that, like

您可以为此定义 CSS 样式,例如

.space { margin-top: 300px; }

And insert it wherever you want to...

并将其插入到您想要的任何位置...

<div class="space"></div>

Hope that helps...

希望有帮助...

回答by Beenish Khan

That is definitely not the way to have spacing.

这绝对不是间距的方式。

Use Css's padding property : http://www.w3schools.com/css/css_padding.asp

使用 Css 的 padding 属性:http: //www.w3schools.com/css/css_padding.asp

回答by Ali Issa

use padding between divs or td's instead of <br />

在 div 或 td 之间使用填充而不是 <br />

回答by skhurams

The question was It would be helpful if someone could explain why using multiple
is not recommended

问题是如果有人能解释为什么
不推荐使用多个会很有帮助

It's better to use padding or margins on your elements to get the spacing you need. It's more precise (every browser can display the br differently)

最好在元素上使用填充或边距来获得所需的间距。它更精确(每个浏览器可以以不同的方式显示 br)

margins and padding is more compatible to almost all browsers

边距和填充对几乎所有浏览器都更兼容

回答by Chiwda

Old question, but evergreen.

老问题,但常青。

If you really want to use multiple < br > tags, you can do so with

如果你真的想使用多个 <br> 标签,你可以这样做

<br />&nbsp;<br />

I find this useful when I want whitespace between paragraphs. Using Div tags to do that is a really bad overkill hack, sorry guys. :-)

当我想要段落之间的空白时,我发现这很有用。使用 Div 标签来做到这一点是一个非常糟糕的矫枉过正的黑客,抱歉各位。:-)