开发者社区> 问答> 正文

页面滚动后布局固定怎么做

screenshot
如图,我希望将右边的布局在滚动后还能够显示。

展开
收起
a123456678 2016-05-26 16:54:14 1693 0
1 条回答
写回答
取消 提交回答
  • <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <meta http-equiv="Content-Type" content="text/html"; charset="GBK"/>
        <title>固定上下层的位置</title>
        <style type="text/css">
    <!--
    body {
        background-image: url(0);
        background-attachment: fixed;
    }
    #BottomNav {
        background: #9F6;
        z-index: 999;
        position: fixed;
        bottom: 0;
        left: 0;
        width: 100%;
        height: 30px;
        position: fixed;
        top: expression(documentElement.scrollTop + documentElement.clientHeight-this.offsetHeight);
        overflow: visible;
    }
    #topNavWrapper {
        height: 30px;
        margin: 0px auto;
        width: 100%;
        z-index: 100;
        position: fixed ;
        top: 0px;
        left: 0;
        background: #9F6;
    }
    #center {
        width: 100%;
        height: 100%;
        padding-top: 30px;
        padding-bottom: 30px;
    }
    -->
        </style>
    </head>
    <body>
        <div id="topNavWrapper">固定悬浮导航在此处,不随滚动条的滚动变化</div>
        <div id="center">
            <p>我是中间层</p>
            <p>我是中间层</p>
            <p>我是中间层</p>
            <p>我是中间层</p>
            <p>我是中间层</p>
            <p>我是中间层</p>
            <p>我是中间层</p>
            <p>我是中间层</p>
            <p>我是中间层</p>
            <p>我是中间层</p>
            <p>我是中间层</p>
            <p>我是中间层</p>
            <p>我是中间层</p>
            <p>我是中间层</p>
            <p>我是中间层</p>
            <p>我是中间层</p>
            <p>我是中间层</p>
            <p>我是中间层</p>
            <p>我是中间层</p>
            <p>我是中间层</p>
            <p>我是中间层</p>
            <p>我是中间层</p>
            <p>我是中间层</p>
            <p>我是中间层</p>
            <p>我是中间层</p>
            <p>我是中间层</p>
            <p>我是中间层</p>
            <p>我是中间层</p>
            <p>我是中间层</p>
            <p>我是中间层</p>
            <p>我是中间层</p>
            <p>我是中间层</p>
            <p>我是中间层</p>
            <p>我是中间层</p>
            <p>我是中间层</p>
            <p>我是中间层</p>
        </div>
        <div id="BottomNav">固定悬浮导航在此处,,不随滚动条的滚动变化</div>
    </body>
    </html>
    2019-07-17 19:16:33
    赞同 展开评论 打赏
问答地址:
问答排行榜
最热
最新

相关电子书

更多
动态、高效,蚂蚁动态卡片的内核逻辑 立即下载
低代码开发师(初级)实战教程 立即下载
阿里巴巴DevOps 最佳实践手册 立即下载