gpt4 book ai didi

html - 放置在 100% 高度容器内时,Overflown DIV 不显示垂直滚动条

转载 作者:搜寻专家 更新时间:2023-10-31 08:33:27 25 4
gpt4 key购买 nike

如何让 container div 在 Firefox 中显示垂直滚动条(它在 Chrome 中有效,我不关心 IE*)?通过“制作”,我的意思是让它在不使用 JS 的情况下工作。

Fiddle

<html>
<head>
<title></title>
<style type="text/css">

.full-size { width: 100%; height: 100%; }
.full-height { height: 100%; }
.table { display: table; }
.table-row { display: table-row; }
.table-cell { display: table-cell; }
.thin-border { border: 1px solid gray; }
.border-box { -moz-box-sizing: border-box; -webkit-box-sizing: border-box; box-sizing: border-box; }
.small-box { width: 50px; height: 50px; }
</style>
</head>
<body>
<div style="width: 400px; height: 200px; margin: 10px; border: 1px solid #ccc;">
<div class="full-size table">
<div class="table-row" style="height: 45px;">
<div class="table-cell">
<p>Test</p>
</div>
</div>
<div class="table-row full-height">
<div class="table-cell full-height" style="overflow: hidden;">
<div class="full-height" id="container" style="overflow-y: scroll;">
<div class="small-box">A</div>
<div class="small-box">A</div>
<div class="small-box">A</div>
<div class="small-box">A</div>
<div class="small-box">A</div>
<div class="small-box">A</div>
<div class="small-box">A</div>
<div class="small-box">A</div>
<div class="small-box">A</div>
<div class="small-box">A</div>
<div class="small-box">A</div>
<div class="small-box">A</div>
</div>
</div>
</div>
</div>
</div>
</body>
</html>

最佳答案

<body>
<div style="width: 400px; height: 200px; margin: 10px; border: 1px solid #ccc; ">
<div class="table-row" style="height: 45px;">
<div class="table-cell">
<p>Test</p>
</div>
</div>
<div class="full-size table">

<div class="table-row full-height"style="height:200px; overflow-y:scroll;>
<div class="table-cell full-height" >
<div class="full-height" id="container" >
<div class="small-box">A</div>
<div class="small-box">A</div>
<div class="small-box">A</div>
<div class="small-box">A</div>
<div class="small-box">A</div>
<div class="small-box">A</div>
<div class="small-box">A</div>
<div class="small-box">A</div>
<div class="small-box">A</div>
<div class="small-box">A</div>
<div class="small-box">A</div>
<div class="small-box">A</div>
</div>
</div>
</div>
</div>
</div>
</body>

更新了! :

http://jsfiddle.net/v3Ccj/

基本上你只是在错误的地方溢出了!

请记住,父级可以 overflow hidden - 然后子级可以有额外的滚动,这样您就可以更好地控制每个 div 的溢出。

引用:http://www.w3schools.com/cssref/pr_pos_overflow.asp

巧合的是这也将 IE.. :)

关于html - 放置在 100% 高度容器内时,Overflown DIV 不显示垂直滚动条,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17347161/

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