gpt4 book ai didi

html - 将溢出滚动到隐藏的

转载 作者:行者123 更新时间:2023-11-28 06:12:27 26 4
gpt4 key购买 nike

我有一个滚动溢出到一个隐藏的

Fiddle here

问题是页面不会滚动,所以我可以看到其余内容,请注意我希望侧边栏和顶部栏固定在它们的位置,只有灰色的主体可以滚动

html,body{
background-color: #f8f8f8;
height: 100%;
overflow: hidden;
}
/////////////////////////////////////////
<div class="col-xs-12 col-sm-12 col-md-12 col-lg-12" style="background- color: #e5e2e6; color:#000000; padding-top: 20px; overflow:scroll;">
test1<br/><br/><br/><br/><br/>
test2<br/><br/><br/><br/><br/>
test3<br/><br/><br/><br/><br/>
test4<br/><br/><br/><br/><br/>
test5<br/><br/><br/><br/><br/>
test6<br/><br/><br/><br/><br/>
</div>

最佳答案

这是你想要的吗? See this fiddle

删除 overflow: hidden;来自 html, body然后像这样更新 HTML 代码:

HTML 代码已更新:

   <!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" integrity="sha384-1q8mTJOASx8j1Au+a5WDVnPi2lkFfwwEAa8hDDdjZlpLegxhjVME1fgjWPGmkzs7" crossorigin="anonymous">
<link rel="icon" type="image/x-icon" href="{{ asset('favicon.ico') }}" />
</head>
<body style="background-color: #e5e2e6;" >
<div class="container-fluid" style="height:100%;">
<div class="row" style="height:100%;" align="center">
<div class="col-xs-3 col-sm-3 col-md-3 col-lg-3 sidebar" style="height:100%; position: fixed; z-index: 10;">
<p class="title" style="text-align:center; color:#FFFFFF; font-size:2.6vw;">TITLE</p>
</div>
<div class="col-xs-9 col-sm-9 col-md-9 col-lg-9" style="background-color: #3a3633; color:white; z-index: 10; margin-left: 25%; position: fixed; ">
<span class="label label-default pull-left" style="font-size:15px; margin:1%;">TEST</span>
</div>
<div class="col-xs-12 col-sm-12 col-md-12 col-lg-12" style="background-color: #e5e2e6; color:#000000; padding-top: 30px; padding-left: 25%; ">
test1<br/><br/><br/><br/><br/>
test2<br/><br/><br/><br/><br/>
test3<br/><br/><br/><br/><br/>
test4<br/><br/><br/><br/><br/>
test5<br/><br/><br/><br/><br/>
test6<br/><br/><br/><br/><br/>
</div>
</div>

</div>
</div>
</div>

我添加了 position: fixed;到您想要修复的元素并添加一些填充以正确显示内容

我已经更改了灰色内容:

<div class="col-xs-12 col-sm-12 col-md-12 col-lg-12" style="background-color: #e5e2e6; color:#000000; padding-top: 30px; padding-left: 25%; ">

padding-left: 25%;因为左边栏的宽度

padding-top: 30px;因为顶栏的高度

顶部栏:

<div class="col-xs-9 col-sm-9 col-md-9 col-lg-9" style="background-color: #3a3633; color:white; z-index: 10; margin-left: 25%; position: fixed; ">

margin-left: 25%;是左边栏的宽度

左侧边栏:
<div class="col-xs-3 col-sm-3 col-md-3 col-lg-3 sidebar" style="height:100%; position: fixed; z-index: 10;">

z-indexposition: fixed;用于放置第一计划的两个固定杆

仅供引用

不需要包含所有 col-xs col-sm col-mdcol-lg如果您要对列使用相同的大小。例如仅包括 col-xs-3将适用于所有col-xs-3 col-sm-3 col-md-3col-lg-3 .和 col-sm-9将为 col-xs-9 工作col-sm-9 col-md-9col-lg-9

关于html - 将溢出滚动到隐藏的,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36088903/

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