why
and not
?

前端 未结 13 1073
天涯浪人
天涯浪人 2020-12-29 05:29

This is one of those things that you read once, say \"aha!\" and then forget. Exactly my case.

Why is the line-break tag in xhtml preferentially written with a space

13条回答
  •  抹茶落季
    2020-12-29 05:48

    A little background to add to Matt Hamilton's answer.

    A least one problem browser was Netscape 4. A quick check shows that in that browser,
    (i.e. no space) doesn't cause a line break. In fact, it doesn't appear to do anything.
    (i.e. with space) does perform a line break.

    When creating polyglot documents that can behave as XHTML or HTML (Note: "behave as" - not "valid") it's necessary to use either
    or

    . However, when parsed as HTML,
    is treated as if it was
    , so

    produces two line breaks.

提交回复
热议问题