[英]How to vertically align a div at the bottom and overflow auto
I have the following html 我有以下HTML
<div class="ex">
<div class="ex0">
<div class="ex1">
<div class="ex2">
....
</div>
<div class="ex3">
....
</div>
</div>
</div>
</div>
ex0 is absolutely positioned. ex0绝对定位。 ex1, ex2, ex3 are relatively positioned.
ex1,ex2,ex3相对定位。 ex0 and ex1 has overflow auto.
ex0和ex1具有自动溢出功能。 ex1 has a min height of 480px;
ex1的最小高度为480px; and ex2 has a height of 100%;
ex2的高度为100%;
Two questions 两个问题
Here's the CSS: 这是CSS:
.ex {
position: absolute;
min-width: 1000px;
min-height: 480px;
left: 0px;
right: 0px;
top: 0px;
bottom: 0px;
z-index: 200;
background: #262626;
}
.ex0 {
box-sizing: border-box;
position: absolute;
display: block;
width: 430px;
right: 0px;
top: 0px;
bottom: 0px;
padding: 0px;
margin: 0px;
border-left: 2.5px solid #1c1c1c;
overflow: auto;
}
.ex1 {
position: relative;
height: 100%;
padding: 52.5px 65px 40px 50px;
overflow: auto;
}
.ex2 {
min-height: calc(100% - 250px);
}
.ex3 {
position: relative;
width: 100%;
}
Do change your "ex3" class by below changes for your first question's answer. 请针对以下第一个问题的答案,通过以下更改来更改“ ex3”类。 It will place ex3 div at the bottom of page.
它将ex3 div放在页面底部。
.ex3 {
position: absolute;
bottom: 0;
}
About your second question. 关于第二个问题。 Scroll bar is displaying on browser screen when I created demo using html and css you provided in question.
当我使用您提供的html和css创建演示时,滚动条显示在浏览器屏幕上。 And when I resize screen for smaller height, scroll bar is persist on page.
当我将屏幕尺寸调整为较小的高度时,滚动条仍保留在页面上。
Please check jsfiddle link to get more idea about it. 请检查jsfiddle链接以了解更多信息。
Delete .ex2 and write in .ex3: 删除.ex2并写入.ex3:
.ex3 {position: absolute; width: 100%; bottom: 0;}
the scroll bar should be work! 滚动条应该正常工作!
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.