需求:
需要把导航固定在底部?只能滑动内容,导航菜单固定不动的。效果如下:
这篇文章主要讲解三种实现方案,包括:fixed,absolute,以及css3的flex布局。
html结构如下:
<div class="box">
<div class="roll">滚动区域</div>
<footer>底部固定菜单</footer>
</div>
<!---公用样式--->
<style>
html,body{
margin:0;padding:0;height:100%;width:100%;
}
footer{
background:#F2F3F6;max-width: 750px;width: 100%;height: 1rem;
}
</style>
方法一:使用fixed
.box{ .roll{ padding-bottom:1rem; } footer{ position:fixed;bottom:0;z-index:999; } }
暂无评论内容