What is the difference between and space?

There are two snippets of HTML code:

1.

<div>&nbsp;</div>

2.

<div> </div>

I run them in Chrome 43.0.2357.130m separately.

The first fragment divhas a height (height = 18px), but the second has no height (height = 0).

I wonder why they have different results.

Thank: -)!

+4
source share
2 answers

& nbsp - non-captive space. This means that he is always interpreted as a character. For example, two words separated by the & nbsp: symbol will always remain together, but two words separated by a space can be separated by a new line if the container is too small.

"Meh, , , , , < 3", a & nbsp " "

( ), . & nbsp . & nbsp , , .

+8

, . &nbsp; .

0

All Articles