在 html 的同一行中有空格
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/11135368/
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
Having space in the same line in html
提问by lakesh
I would like to have some space between the same line.. I know there are elements such as <br>, <p>
and others. Instead of using these, I would like to add little space between the characters...
我想在同一行之间有一些空间.. 我知道有诸如<br>, <p>
和其他元素。而不是使用这些,我想在字符之间添加一点空间......
Example Code:
示例代码:
<strong>
New? Register here!
</strong>
<span>
Register
</span>
I would like to have some space between them. How can do this in HTML?
我想在他们之间留一些空间。如何在 HTML 中做到这一点?
回答by flyx
In your example, you may apply some CSS rules, e.g.:
在您的示例中,您可以应用一些 CSS 规则,例如:
span {
margin-left: 5em;
}
Or inline:
或内联:
<strong>
New? Register here!
</strong>
<span style="margin-left: 5em;">
Register
</span>
回答by Stefan Haustein
Add
for a space character that will not be collapsed.
添加
一个不会折叠的空格字符。
Alternatively, add a span with a certain width, e.g.
或者,添加具有特定宽度的跨度,例如
<span style="width:50px;display:inline-block"></span>
(I think the element needs to be of display type inline-block
to respect block properties such as padding, border, margin, width etc.).
(我认为元素需要是显示类型inline-block
以尊重块属性,例如填充、边框、边距、宽度等)。
回答by iMom0
use this instead:
改用这个:
<strong>
New? Register here!
</strong>
<span>
Register
</span>
回答by Bishnu Paudel
Just add ' br/ ' before closing strong tag
只需在关闭强标签之前添加 'br/'
回答by U.P
for space character.
为空格字符。
Wonder why you need that.
想知道你为什么需要那个。