Is it bad use “display: table;” to organise a layout into 2 columns?

后端 未结 9 1839
感动是毒
感动是毒 2021-01-01 20:37

I am trying to make a 2 column layout, apparently the bane of CSS. I know you shouldn\'t use tables for layout, but I\'ve settled on this CSS. Note the use of display: table

9条回答
  •  有刺的猬
    2021-01-01 21:12

    Using the display:table is fine when you're talking about semantics. The reason "tables are bad" in the first place is because the markup (HTML) is supposed to describe the content inside of it. So, if it's not data, it doesn't belong in a table.

    Since you're just setting how the markup displays (in a table structure), that's perfectly fine.

    However, this will not work for all browsers. Specifically IE6 and IE7 (and IE8 in "compatibility mode") will not display this correctly.

    For more information on display types and browser support, you can refer to this: http://www.quirksmode.org/css/display.html

提交回复
热议问题