Html 如何使用“ ” 在 HTML5 中

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/33384318/
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-29 18:25:31  来源:igfitidea点击:

How to use " " in HTML5

html

提问by siva kumar

In HTML using  for space, I get one space in the output. If my requirement needs more spaces say 100, then how to make that tag efficient? Should I type  100 times?

 用于空格的HTML 中,我在输出中得到一个空格。如果我的要求需要更多空间,比如 100,那么如何使该标签高效?我应该输入 100 次吗?

回答by user2473779

As mentioned in the comments, you should be using css for this. However, if you have to do it in html, use 'pre' tags:

正如评论中所述,您应该为此使用 css。但是,如果您必须在 html 中执行此操作,请使用 'pre' 标签:

<pre>hello       world</pre>  //prints with extra spaces in between

回答by Vishal Kumar

&nbsp;is generally used when you are intended to place a space. It is generally used when you are considering the design in terms of space a letter occupies.

&nbsp;通常在您打算放置空间时使用。当您根据字母占用的空间考虑设计时,通常会使用它。

If you want to vary space depending upon other factors, feel free to use padding and margin.

如果您想根据其他因素改变空间,请随意使用填充和边距。

回答by srivenkat

you will use directly &nbsp;(or) &#160;for needed places. ex:

您将直接&nbsp;(或)&#160;用于需要的地方。前任:

<img src="vj.jpg">&nbsp;<img src="ss.jpg">

the pictures displayed in sequence with space.

图片按空格顺序显示。