what are the problems with display:table? [duplicate]
Possible Duplicate:
Is there a disadvantage of usingdisplay:table-cell
on divs?
I think display:table is a easy way of managing the layout of a webpage, at least a general开发者_如何学运维 layout. But it looks like it is not widely used. I know it is unsupported or has issues wit ie6 and ie7 but for sites not trying to be compatible with those browsers there is any drawback from using display:table?
You may be thinking of this in terms of the table element within html. To answer your question in that sense, yes. Positioning elements with display:table in css is more or less just a way of forming a table-like display to correctly position an element. It requires less hassle in the way of floating div's and such. As long as you are just forming a display that will correctly position your elements, it is perfectly fine, you should NOT obstruct the html code though by using a table to perform the same tasks that you would use display:table for. The only downside of using css display:table is that a cell can still stretch to fit the content contained within it compared to setting a height and width in a specific div.
精彩评论