Is it safe to omit and tags?

后端 未结 10 2080
广开言路
广开言路 2020-12-05 22:41

According to w3c and tags are optional, so the following table is perfectly valid.



        
      
      
      
10条回答
  •  庸人自扰
    2020-12-05 23:24

    Close all tags in HTML for a few reasons:

    1. Not closing tags is tolerated, but it is not correct modern XHTML. It's deprecated much in the same way that HTML style attributes are in favor of CSS
    2. It's more readable for the next guy if you close the tags
    3. Browsers will actually have an easier time parsing your source if it more strictly adheres to the rules, even if that makes the source longer

提交回复
热议问题