且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

何时使用& nbsp

更新时间:2022-10-14 22:00:07

& nbsp; (它应该在最后有一个分号)是一个非空格的实体。



在两个单词之间使用它,没有在他们之间通过换行插入换行符。



a关于什么时候这是合适的语法的好解释。

网页内容之间的空间(因为它不会像多个常规空间一样崩溃)。填充和边距通常应该用来代替这种黑客行为。

I have seen &nbsp in html and can't quite tell what it does other than create some whitespace. I am wondering what exactly it does and when it should be used?

  (it should have a semi-colon on the end) is an entity for a non-breaking space.

Use it between two words that should not have a line break inserted between them by word wrapping.

There is a good explanation about when this is appropriate grammar on the English StackExchange.


It is sometimes abused to create horizontal space between content in web pages (since it will not collapse like multiple regular spaces). Padding and margins should usually be used instead of this hack.