有没有一种优雅的方式来制作/生成空间而不是  ?
我需要在 HTML 文件中生成空格。
I need to generate spaces in a HTML file.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
我需要在 HTML 文件中生成空格。
I need to generate spaces in a HTML file.
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
接受
或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
发布评论
评论(7)
使用
或
Use either
or
<pre>
tags. The<pre>
tag preserves all spaces, tabs and newlines.EDIT
Regarding your comment about its use, for padding, you may want to look at css padding
这一切都取决于上下文,您可以使用字母间距、单词间距或例如周围跨度的填充。
如果没有更多信息,就不可能给出好的建议。
编辑:如果它用于文本/单词之间,我会选择单词间距,也许还有字母间距。
It all depends on the context, you can use letter-spacing, word-spacing or for example padding for surrounding span's.
Without more information it´s impossible to give a good advice.
Edit: if it´s for use in texts / in between words, I´d go for the word-spacing and perhaps letter-spacing.
我几乎从不使用
margin
和padding
属性对于间距和
效果很好> 用于换行符。 (我也不经常使用
。)I hardly ever use
margin
andpadding
properties work well for spacing and<br />
for newlines. (I don't use<br />
too frequently either.)是一个不间断的空格。或者,我想您可以使用
(那里是 XHTML)标记来生成新行。is a non-breaking space. Alternatively I guess you could use a
<br />
(XHTML there) tag just to generate a new line.我使用带有 css 类的跨度。
我有几个类,如 spacer_1、spacer_2、spacer_3 等。
我使用不同的水平填充,像这样
使用这个垫片,你可以使用以下
i use a span with css classes.
i have several class like spacer_1, spacer_2, spacer_3, etc..
i use different horizontal padding like this
to use this spacer you can use the following
就这样做:
just do:
雅各比是对的。但我有一些不同的东西:
顺便说一句,您应该用
替换
以符合 XHTML。
Yacoby is right. But i have something different:
And by the way you should replace
with
to conform to XHTML.