display:表与使用表 [英] display:table versus using tables
问题描述
我想知道如果使用CSS显示属性来模拟一个简单的论坛系统的表格是一个好主意。
I was wondering if it's a good idea to use CSS display property to emulate tables for a veeeery simple forum system.
我知道这不是好事但是我想现在所有的浏览器都支持它,对吗?
I know this wasn't good thing to do like 2 years ago when IE and maybe others did not support display:table / table-cell etc. But I think now all browsers support it, right?
推荐答案
如果论坛上显示的信息是表格,那么不要害怕使用表格,如果它在语义上有意义。
If the information being displayed on the forum is tabular, then don't be afraid to use a table if it makes sense semantically.
对于一般的页面布局,个人我不会使用它。我会坚持典型的块级div布局和浮动。 IE7不支持显示:表和有其他注意事项,例如它将基于内容在宽度上扩展的事实。对于未来,我期待着 Flexbox 完全支持。
For general page layout, personally I wouldn't use it. I'd stick to the typical block-level div layouts and floats. IE7 does not support display:table and there are other caveats, such as the fact that it will expand in width based on content. For the future, I look forward to when flexbox is fully supported.
我偶尔使用display:inline-block来居中动态列表项等。
I do occasionally use display:inline-block for centering dynamic list items and the like.
这篇关于display:表与使用表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!