why
and not
?

前端 未结 13 1047
天涯浪人
天涯浪人 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 06:07

    If I recall correctly it's simply because some older browsers had problems with a self-closing tag without a space before the slash. I doubt it's an issue nowadays, but a lot of developers (myself included) got into the habit of including the space.

    Edit: Ah, here we are:

    http://www.w3.org/TR/xhtml1/#guidelines

    Include a space before the trailing / and > of empty elements, e.g.
    ,


    and Karen. Also, use the minimized tag syntax for empty elements, e.g.
    , as the alternative syntax

    allowed by XML gives uncertain results in many existing user agents.

提交回复
热议问题