看看这个页面: http://labs.pieterdedecker.be/hetoog/layout.htm
它在 Firefox 中看起来不错,但 IE 却搞砸了。怎么会?
最佳答案
您的布局有点有趣。不要在页面的任何一侧使用空表格单元格,您可以将它们取出并使用
body {
width: 750px;
margin: 0 auto;
}
你的 HTML 可能是这样的:
<body>
<table>
<tr>
<td class="splash_desc">...</td>
<td class="splash_photo">...</td>
</tr>
...
使用这种方法,IE 不会比其他浏览器占用更多空间,并且可以很好地适应 750 像素宽的容器。
编辑:
要使标题栏水平拉伸(stretch) 100%,您必须为内容制作另一个 div。因此,不要使用 body 元素来设置宽度,而是使用如下内容:
<body>
<table id="header"><tr>...</tr></table>
<div id="wrapper">
<table>
<tr>
<td class="splash_desc">...</td>
<td class="splash_photo">...</td>
</tr>
...
在 CSS 中:
#wrapper {
width: 750px;
margin: 0 auto;
}
这样你就可以让 wrapper 上方的表格为 100% 宽(只要这样设计),而 wrapper 本身是 750px 宽。
关于html - 为什么此页面无法在 Internet Explorer 中正确呈现?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1851979/