Using the XHTML closing slash (/) on normal tags?

后端 未结 3 1872
無奈伤痛
無奈伤痛 2020-12-21 08:02

I was just wondering whether it is acceptable to close a common tag, eg. a which requires no data using the XHTML closing slash to reduce markup.

相关标签:
3条回答
  • 2020-12-21 08:41

    No you can't do that, span is not self-closing tag. Here are the self closing tags:

    <area />
    <base />
    <basefont />
    <br />
    <hr />
    <input />
    <img />
    <link />
    <meta />
    
    0 讨论(0)
  • 2020-12-21 08:41

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

    0 讨论(0)
  • 2020-12-21 08:58

    There are empty or self-closing tags. Span is not one of them.

    http://justinsomnia.org/2005/12/there-are-only-10-legal-xhtml-empty-tags/

    0 讨论(0)
提交回复
热议问题