What are all the valid self-closing elements in XHTML (as implemented by the major browsers)?

前端 未结 13 1857
夕颜
夕颜 2020-11-22 05:16

What are all the valid self-closing elements (e.g.
) in XHTML (as implemented by the major browsers)?

I know that XHTML technically allows any element to

13条回答
  •  夕颜
    夕颜 (楼主)
    2020-11-22 05:59

    The last time I checked, the following were the empty/void elements listed in HTML5.

    Valid for authors: area, base, br, col, command, embed, eventsource, hr, img, input, link, meta, param, source

    Invalid for authors: basefont, bgsound, frame, spacer, wbr

    Besides the few that are new in HTML5, that should give you an idea of ones that might be supported when serving XHTML as text/html. (Just test them by examining the DOM produced.)

    As for XHTML served as application/xhtml+xml (which makes it XML), XML rules apply and any element can be empty (even though the XHTML DTD can't express this).

提交回复
热议问题