解决办法使表格单元格 CSS 在 IE6/7 中正确渲染?

发布于 2024-09-11 06:21:17 字数 577 浏览 1 评论 0原文

我的网站在 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

痴情 2024-09-18 06:21:17

来自 W3Schools

没有 Internet Explorer 版本
(包括IE8)支持该属性
值“内联表”,“运行”,
“表格”,“表格标题”,
“表格单元格”、“表格列”、
“表列组”、“表行”或
“表行组”。

最好的解决方案可能是构建一个真实的表。

From W3Schools:

No versions of Internet Explorer
(including IE8) support the property
values "inline-table", "run-in",
"table", "table-caption",
"table-cell", "table-column",
"table-column-group", "table-row", or
"table-row-group".

The best solution is probably to build a real table.

怎言笑 2024-09-18 06:21:17

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文