HTML table browser render issues

后端 未结 1 762
感情败类
感情败类 2021-01-29 06:03

a. Consider this markup:

When i inspect the page i get:



        
相关标签:
1条回答
  • 2021-01-29 06:40

    Both sets of HTML are invalid and the browser is performing error recovery. The recovery rules (or rather, the general parser rules) for a span inside a table element are different to the recovery rules for a th inside a table element.

    (To oversimplify, a th element has to be inside a tr inside a tbody/tfoot/thead inside a table … so the missing elements are added, but a span doesn't have to be inside a table at all so is thrown out).

    You should just write valid HTML from the outset.

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