在表_td_中溢出自动,没有一定的高度 [英] Overflow auto in table _td_ that has no certain height
本文介绍了在表_td_中溢出自动,没有一定的高度的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个固定高度的表,其中一行具有固定高度,另一行具有高度,当内部内容较高时,我需要在弹性行中获取滚动条。
可以吗?
< table style =width:50%; height:300px; overflow :auto>
< tr>
< td style =height:50px; background:gray>< / td>
< / tr>
< tr style =overflow:auto>
< td style =background:yellow; overflow:auto>
< script>
for(i = 0; i <= 30; i ++){
document.write(i +Sample text< br&
}
< / script>
< / td>
< / tr>
< / table>
UPD:更改代码更加明确。我需要overflow:auto在我的黄色块。
插入大量内容表高度超过300px
解决方案
查看工作示例
放置 >
> / p>
< table style =width:50%; height:300px; overflow:auto>
< tr>
< td style =height:50px; background:gray>< / td>
< / tr>
< tr style =overflow:auto>
< td style =background:yellow;>
< div style =height:500px; overflow:auto; overflow-x:scroll; overflow-y:scroll;>
高内容
< / div>
< / td>
< / tr>
< / table>
I have a table with fixed height in which one row has fixed height and another gets height left and I need to get scrollbar in the flexible row when its inner content is high. Is it possible to do?
<table style="width: 50%; height: 300px; overflow:auto">
<tr>
<td style="height: 50px;background:grey"></td>
</tr>
<tr style="overflow:auto">
<td style="background:yellow; overflow:auto">
<script>
for (i = 0; i <= 30; i++) {
document.write(i + " Sample text<br>");
}
</script>
</td>
</tr>
</table>
UPD: Changed the code to be more explicit. I need overflow:auto on my yellow block. After inserting a lot of content table height exceeds 300px
解决方案
See Working Example
Putting a div
inside your flexible td
and settings its overflow
property should do the trick:
<table style="width: 50%; height: 300px; overflow:auto">
<tr>
<td style="height: 50px;background:grey"></td>
</tr>
<tr style="overflow:auto">
<td style="background:yellow;">
<div style="height: 500px; overflow:auto; overflow-x:scroll; overflow-y:scroll;">
high content
</div>
</td>
</tr>
</table>
这篇关于在表_td_中溢出自动,没有一定的高度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文