我似乎無法使頁腳粘到可滾動div的底部。 當div有幾個字符或多個字符和溢出時,頁腳應該緊貼底部。還要注意這不是在身體上,而是任何任意的div。絕對定位頁腳在可滾動div
<div class="blue">
<div class="red">
Nam liber tempor cum soluta nobis eleifend option congue nihil imperdiet doming id quod mazim placerat facer possim assum. Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet Nam liber tempor cum
soluta nobis eleifend option congue nihil imperdiet doming id quod mazim placerat facer possim Nam liber tempor cum soluta nobis eleifend option congue nihil imperdiet doming id quod mazim placerat facer possim soluta nobis eleifend option congue
nihil imperdiet doming id quod mazim placerat facer possim Nam liber tempor cum soluta nobis eleifend option congue nihil imperdiet doming id quod mazim placerat facer possim soluta nobis eleifend option congue nihil imperdiet doming id quod mazim
placerat facer possim Nam liber tempor cum soluta nobis eleifend option congue nihil imperdiet doming id quod mazim placerat facer possim
</div>
<div class="lime">footer</div>
</div>
<style>
* {
box-sizing: border-box;
}
html {
height: 90%
}
body {
height: 100%;
}
.blue {
position: relative;
border: solid 5px blue;
height: 100%;
overflow-y: auto;
}
.red {
width: 200px;
border: solid 5px red;
margin-bottom: 100px;
}
.lime {
position: absolute;
bottom: 0px;
width: 250px;
height: 100px;
border: solid 5px lime;
}
</style>
這裏是我的小提琴:https://jsfiddle.net/CaptM44/yk99pgzz/
UPDATE: this image shows the requirements
通知內容長度和滾動條位置
我需要一點澄清:「頁腳應該堅守底部」底部是什麼?藍色的div,紅色的div或屏幕的底部? 「當div有幾個字符或多個字符並溢出時。」哪個div有幾個字符或多個字符? –
我添加了一個圖片的要求。 – user8285970