Handling of non breaking space:

 

vs.

前端 未结 3 1368
夕颜
夕颜 2021-01-30 12:40

  is a non breaking space, which represents an empty space where no line break occurs.

If I use

 

3条回答
  •  滥情空心
    2021-01-30 13:14

    In HTML, elements containing nothing but normal whitespace characters are considered empty. A paragraph that contains just a normal space character will have zero height. A non-breaking space is a special kind of whitespace character that isn't considered to be insignificant, so it can be used as content for a non-empty paragraph.

    Even if you consider CSS margins on paragraphs, since an "empty" paragraph has zero height, its vertical margins will collapse. This causes it to have no height and no margins, making it appear as if it were never there at all.

提交回复
热议问题