解决办法使表格单元格 CSS 在 IE6/7 中正确渲染?
我的网站在 IE8/Firefox/Chrome 中显示正常,但我不知道如何使其在 IE 中正常运行。
相关的 CSS:
#maincontent {
display: table;
}
#content {
display: table-cell;
width: 620px;
padding-left:4%;
padding-right: 22px;
padding-bottom:15px;
}
#sidebar {
display: table-cell;
width: 300px;
}
#content
和 #sidebar
位于 #maincontent
中。在 IE6/7 上,#sidebar
将位于 #content
下。我尝试使用 float
将侧边栏设置为 display:block
,然后它会在 IE6/7 中正常渲染,但所有其他浏览器都会搞砸。我怎样才能得到这个设置?
My site is showing up fine in IE8/Firefox/Chrome but I can't figure out how to make it function with IE.
The relevant CSS:
#maincontent {
display: table;
}
#content {
display: table-cell;
width: 620px;
padding-left:4%;
padding-right: 22px;
padding-bottom:15px;
}
#sidebar {
display: table-cell;
width: 300px;
}
#content
and #sidebar
are in #maincontent
. On IE6/7 #sidebar
will be under #content
. I've tried setting the sidebar to display:block
with a float
, and it will then render fine in IE6/7 but all the other browsers get screwed up. How can I get this setup?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
来自 W3Schools:
最好的解决方案可能是构建一个真实的表。
From W3Schools:
The best solution is probably to build a real table.
IE 不支持 CSS 表,因此您可能想尝试仅使用浮动和边距。我建议您查看其中一个模板上的定位并从那里开始工作。
CSS tables aren't supported in IE, so you'll probably want to try working with just floats and margins. I'd recommend taking a look at the positioning on one of these templates and working from there.