[英]Placing a child div always bottom of the parent div
I am trying to design a html layout wherein the child div should always remain at the bottom of the parent div. 我正在尝试设计一个HTML布局,其中子div应该始终保留在父div的底部。 The height of the parent div should be 100% by default. 默认情况下,父div的高度应为100%。 Please provide me a solution for the same. 请为我提供相同的解决方案。
link: https://jsbin.com/pihekufime/edit?html,css,output 链接: https : //jsbin.com/pihekufime/edit?html,css,output
HTML: HTML:
<div class="wrapper">
<div class="header"></div>
<div class="left">menu</div>
<div class="content">
Lorem ipsum dolor sit amet, consectetur adipiscing...
<div class="bottom">index</div>
</div>
</div>
CSS: CSS:
html, body {
height: 100%;
padding:0
margin:0;
}
.header {
background: #4a90e2;
height: 100px;
position: fixed;
width:100%;
}
.left {
position: fixed;
height: 100%;
top: 100px;
background: #F44336;
width: 20%;
}
.content {
position: relative;
height: 100%;
top: 100px;
left: 20%;
background: #555;
width: 80%;
color:#fff;
min-height: 100%;
}
.bottom {
position: absolute;
bottom: 0px;
background: yellow;
}
The div with class 'Bottom' should always stay at the bottom of the div with class 'Content' wherein the other divs are fixed “底部”类的div应该始终位于“内容”类的div的底部,其中其他div是固定的
If you set you .wrapper
to 100% height, the .content
will also be 100% of the height, and the .bottom
will be positioned at the bottom of this div. 如果将.wrapper
设置为100%的高度,则.content
还将为高度的100%,并且.bottom
将位于该div的底部。 This might not be the behaviour you want, but it is the answer to your question (we dont have info about how the entire thing should work/expand/scroll/align with content) 这可能不是您想要的行为,但这是您问题的答案(我们没有关于整个过程如何工作/扩展/滚动/与内容对齐的信息)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.