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

后端 未结 9 1847
感动是毒
感动是毒 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:07

    There are two essential arguments for not using tables:

    1. Semantic markup.
    2. Avoiding tag soup. (too many tags)

    So, your method is not really violating either of those goals. However, you should check this code in IE7 and IE6 - you are likely to see some inconsistencies there.

    As was mentioned - don't worry about sticking to these rules too tightly. They are guidelines, and you should use the right tool for the job you are doing. What is important here is knowing what the various techniques are best for, and when to use them. Sometimes, using a table is the best tool for what you are trying to do, sometimes it is not.

提交回复
热议问题