上下栏固定, 中间滚动的HTML模板

因为用position是脱离文档流的,所以在最上面嘛,

中间用overflow:auto就会出现滚动效果

代码

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <style>
        #ac-globalnav {
            position: absolute;
             margin: 0;
             left: 0;
             top: 0;
             width: 100%;
             min-width: 1024px;
             height: 88px;
             max-height: 100px;
             background: #333;
             background: rgba(0,0,0,0.8);
             font-size: 17px;
             user-select: none;
         }
         #web_button {
            position: absolute;
            bottom: 0;
            left: 0;
            right: 0;
            margin: 0;
            width: 100%;
            min-width: 1024px;
            height: 44px;
            max-height: 100px;
            background: #333;
            background: rgba(0,0,0,0.8);
            font-size: 17px;
            user-select: none;
            line-height:44px;

         }

        li {
              display: inline;
              list-style:none;
              margin:0 35px 0 35px;
              color: #fff;
              line-height:58px;
              cursor:pointer;

        }

        li:hover{
            color: red;
            <!--想换加入背景色的话, 可以使用background-->
        }
        ul {float:left; margin-left:18%;}

    .content{
        position: fixed;
        left: 0;
        right: 0;
        padding: 0;
        margin: 0;
        top: 88px;
        bottom: 44px;
        overflow: auto;
        background: red;
    }
    </style>
</head>
<body>
<!--top-->
<div>
    <div id="ac-globalnav">
        <ul>
            <li>首页</li>
            <li>自学教程</li>
            <li>指法表</li>
            <li>曲谱</li>
            <li>视频作品</li>
            <li>资料下载</li>
            <li>社区</li>
            <li>搜索</li>

            <li></li>
        </ul>
    </div>

</div>

<!--body-->
<div class="content">
    <div style="height: 2000px;">
    <h3>adf</h3>
    <h3>adf</h3>
    <h3>adf</h3>
    <h3>adf</h3>
    <h3>adf</h3>
    <h3>adf</h3>
    <h3>adf</h3>
    </div>
</div>

<!--button-->
<div>
        <div id = "web_button">
            <center>所有权...</center>
        </div>

</div>

</body>
</html>

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值