Why use tables to structure your layout?

后端 未结 14 881
孤城傲影
孤城傲影 2020-12-23 23:02

Looking at the source code for Stack Overflow, I noticed they have used tables and inline CSS quite a bit, also something I found odd was use of inline table attribute forma

14条回答
  •  夕颜
    夕颜 (楼主)
    2020-12-23 23:29

    Because Internet Explorer does not support the display:table CSS property, which is what provides the grid-like layout model (equivalent to how html tables are rendered). The grid-model is the simplest and most flexible way to model many layouts.

    So you have three choices, none of them attractive:

    • sacrifice support for Internet Explorer (all other modern browsers supports display:table property, which have been part of the CSS2 standard for more than a decade)
    • use cumbersome CSS workarounds which are costly and hard to maintain.
    • sacrifice semantic purity and use TABLE-elements.

    SO chose the last option, probably because they think support for Internet Explorer users is more important than support for disabled users, and because they wanted something that was quick to develop and simple to maintain.

提交回复
热议问题