Sticky footers:
如果页面内容不够长的时候,footer粘贴在视窗底部;如果内容足够长时,footer会被内容向下推送。总的来说就是footer永远在页面的最下面。
例如
我们想要实现 x按钮一直在弹框的最下面
当我们有内容,却不够一屏时:
当超出一屏幕时:
实现:
HTML:
<div class="bg-wrapper">
<div class="main-wrapper">
<div class="detail-main">
放置内容
</div>
</div>
<div class="close">
<i class="icon-close">x</i>
</div>
</div>
对应的scss:(因为我们的是弹框,所以用了fixed布局)
.bg-wrapper {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
backdrop-filter: blur(10px);
overflow: auto;
background: rgba(7, 17, 27, 1);
z-index: 100;
.main-wrapper {
min-height: 100%;
.detail-main {
padding-bottom: 64px;
}
}
.close {
position: relative;
width: 32px;
height: 32px;
margin: -64px auto 0;
font-size: 32px;
clear: both;
}
}