DIV's vs. Tables or CSS vs. Being Stupid

后端 未结 13 2196
清酒与你
清酒与你 2020-11-27 03:48

I know that tables are for tabular data, but it\'s so tempting to use them for layout. I can handle DIV\'s to get a three column layout, but when you got 4 nested DIV\'s, it

13条回答
  •  粉色の甜心
    2020-11-27 04:06

    You use CSS for layout because not only is it semantically correct but because tables have multiple drawbacks.

    Tables are horrible for accessibility because they break almost all screen readers, which in turn gives the visually impaired worthless information because of the way the tables are read.

    They also render much slower than their CSS counterparts. Tables have to be drawn twice, once for the layout, and again for the content. This can mean that if you have a remote image or two on a server with a slow connection that your ENTIRE LAYOUT will not render.

    Would you use an array to store a dictionary when you have a hashmap? No. And you shouldn't use a table when there's something out there which works better.

提交回复
热议问题