如何在 IE 中获得 display:table-cell
支持?我需要最轻的解决方案。
最佳答案
最快(但不干净)的解决方案是将容器包装在条件注释内的表格中,如下所示
<!--[if lte IE 7 ]><table><td><![endif]-->
<div>
<!-- your markup here -->
</div>
<!--[if lte IE 7 ]></td></table><![endif]-->
对于单个页面来说可以接受,但绝对要避免大规模
否则您可以详细指定为什么要尝试定义显示:表格单元格。如果这与获得文本的垂直对齐方式有些关系,您可以查看这段代码
http://jsfiddle.net/fcalderan/985e4/
-- 编辑(评论后)
如果您希望获得底部对齐方式,您还可以将 position :relative
设置为图像容器,然后设置 position:absolute;底部:0;
到图像
-- 编辑2(评论后)
我们仍在等待您的代码。不管怎样,最终的 css 将会是
#imagecontainer { /* or whatever image container you have */
position: relative;
}
#imagecontainer img {
position: absolute;
bottom : 0;
left: 50%;
margin-left:-n/2px; /* where 'n' is width of your image */
}
关于javascript - 如何获得显示 :table-cell support in IE? 任何纯 javascript 或 jQuery 解决方法?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4170883/