Responsive columns(display: table) doesn't work with Safari, Safari(mobile) and Chrome(mobile)

I'm trying to make responsive columns with "display: table" and this is what I've come up with. http://jsfiddle.net/ejkim2000/NXmfk/ html
  • red
  • yellow
  • blue
css body { height: 100%; width: 100%; background-color: #ccc; } #colors { display:block; overflow:hidden; position:relative; height: 1000px; width: 100%; } #columns { height: 100%; width: 100%; display: table; } #columns li { overflow:hidden; width: 33.33%; text-align: center; vertical-align: middle; display: table-row; } .red { background-color: red; } .yellow { background-color: yellow; } .blue { background-color: blue; } @media only screen and (min-width: 479px) { #colors { height: 320px; width: 100%; } #columns li { display: table-cell; } } @media only screen and (min-width: 768px) { #colors { height: 700px; width: 100%; } #columns li { display: table-row; } } @media only screen and (min-width: 980px) { #colors { height: 700px; width: 100%; } #columns li { display: table-cell; } } It's working well with Firefox, IE9, and Chrome(Desktop) whether I rotate the presentation of the browsers or resize the window. It doesn't show any problems. However, it shows very weird behavior with Safari(desktop), Safari(mobile), and chrome(mobile). It shows proper columns in the beginning but once I rotate the screen or resize the window, it's basically adding one or two more empty columns. If you resize my jsfiddle example above with safari, you'll get the idea or this [image][1] shows how it does: I've been searching the answers, but nobody seems to have the same problem as I have. Could you help me to fix this problem? [1]: http://www.ejkimdesign.com/column_examples.jpg
I can confirm that there is something fishy in at least version 7 of Safari when trying to run responsive display: table-cell lis... Could this be a Safari bug?

以上就是Responsive columns(display: table) doesn't work with Safari, Safari(mobile) and Chrome(mobile)的详细内容,更多请关注web前端其它相关文章!

赞(0) 打赏
未经允许不得转载:web前端首页 » CSS3 答疑

评论 抢沙发

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址

前端开发相关广告投放 更专业 更精准

联系我们

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

微信扫一扫打赏