gpt4 book ai didi

html - IE11和IE8相差1个像素

转载 作者:行者123 更新时间:2023-11-28 01:32:50 25 4
gpt4 key购买 nike

示例代码如下:

<html>
<head>
<title> IE11 </title>
<style>
*{
margin: 0;
padding: 0;
}
table{
table-layout: fixed;
border-collapse: collapse;
border-left: 1px solid black;
border-right: 1px solid black;
}
td{
text-align: center;
border-bottom: 1px solid black;
border-right: 1px solid black;
padding: 0 0 0 0;
overflow: hidden;
}
</style>
</head>

<body>
<table width="400px">
<tr>
<td>
<table width="400px">
<tr>
<td style="width:100px">
col1
</td>
<td style="width:100px">
col2
</td>
<td style="width:100px">
col3
</td>
<td style="width:100px">
col4
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td>
<table width="400px">
<tr>
<td style="width:100px">
col1
</td>
<td colspan="2" style="width:200px">
col2 col3
</td>
<td style="width:100px">
col4
</td>
</tr>
</table>
</td>
</tr>
</table>
</body>
</html>

在 IE10 和 IE11 中,合并列中有 1 个像素的偏移:

http://i.stack.imgur.com/GSNMK.png

但是当我在 IE6-9 或 IE11 中使用 Edge=5 运行它时,它呈现完美。

http://i.stack.imgur.com/NRhKE.png

勉强能察觉,但当主表td的元素很大时,就很烦人了。我该如何解决这个问题?

提前致谢。

最佳答案

这取决于如何计算宽度,是否包括边框。

您可以使用 box-sizing css 属性解决此问题:

td{
box-sizing: border-box;
}

关于html - IE11和IE8相差1个像素,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29741744/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com