gpt4 book ai didi

html - 如何在 IE 的表格单元格中将 html 选择元素 css 高度设置为 100%?

转载 作者:可可西里 更新时间:2023-11-01 13:29:03 27 4
gpt4 key购买 nike

我想让一个选择(下拉列表)元素填充表格单元格高度的 100%。我能够让它在 Firefox 和 Chrome 中运行,但不能在 IE (Internet Explorer) 中运行。

测试 HTML:

<table>
<tr>
<td>
Some cell content<br/>
Some cell content<br/>
Some cell content<br/>
</td>
<td>
<select>
<option>Select</option>
</select>
</td>
</tr>
</table>

测试 CSS:

table {width:400px;border:solid 1px #000000;border-collapse:collapse;height:100%}
table td {border:solid 1px #000000;height:100%}
select {width:100%;height:100%;}

Here's the fiddle (适用于 Firefox 和 Chrome,但不适用于 IE)

最佳答案

table {width:400px;border:solid 1px #000000;border-collapse:collapse;height:100%}
table td {border:solid 1px #000000;height:100%}
select {width:100%!important;height:100%!important;}
<table>
<tr>
<td>
Some cell content<br/>
Some cell content<br/>
Some cell content<br/>
</td>
<td>
<select>
<option>Select</option>
</select>
</td>
</tr>
</table>

关于html - 如何在 IE 的表格单元格中将 html 选择元素 css 高度设置为 100%?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32983076/

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