Do browsers remove whitespace in between text of any html tag

后端 未结 3 1973
太阳男子
太阳男子 2020-12-06 04:50

Here is a fiddle demonstrating the problem

http://jsfiddle.net/WM8XW/

I have inserted many whitespace in the content of the label tag but the html rendered s

3条回答
  •  情深已故
    2020-12-06 05:40

    The normal behavior for the display of whitespaces is to compress them into a single one, which is then displayed.

    There are two exceptions from that:

    1. The
       tag, which keeps the whitespaces as entered.
    2. Setting the CSS property white-space: pre; (respectively pre-wrap or pre-line)

提交回复
热议问题