gpt4 book ai didi

css - 当行中包含大图像时,如何使 IE 11 尊重表中的列宽?

转载 作者:技术小花猫 更新时间:2023-10-29 11:45:11 25 4
gpt4 key购买 nike

以下内容在 Chrome(最新版)中运行良好,但奇怪的是在过时的 IE 版本中运行 - 但在最新的 IE 版本 (11) 中,它的行为似乎不像我想要的那样。

在 Chrome(最新)和过时的 IE 版本中,第 1 列不会更改其宽度以适应第 2 列中的大图像,但在最新的 IE 版本 (11) 中会更改 - 如何更正此问题?

<table>
<tr>
<td class="header">
Column 1
</td>
<td class="header">
Column 2
</td>
</tr>
<tr>
<td class="body_twenty">
<table>
<tr>
<td>
Test...
</td>
</tr>
</table>
</td>
<td class="body_eighty">
<table>
<tr>
<td>
Test...
</td>
<td>
Test...
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td class="body_twenty">
<table>
<tr>
<td>
Test...
</td>
</tr>
<tr>
<td>
</td>
</tr>
<tr>
<td>
</td>
</tr>
</table>
</td>
<td class="body_eighty">
Test...
<img src="http://www.psdgraphics.com/file/colorful-triangles-background.jpg">
</td>
</tr>
<tr>
<td class="footer">
</td>
<td class="footer">
</td>
</tr>
</table>

参见:https://jsfiddle.net/tLfur3xz/1/

最佳答案

添加此样式:

table {
table-layout: fixed;
}

Updated Fiddle

当你使用fixed时:

Table and column widths are set by the widths of table and col elements or by the width of the first row of cells.

MDN documentation

关于css - 当行中包含大图像时,如何使 IE 11 尊重表中的列宽?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31233136/

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