首页 > overflow 子内容滑动,body也跟着滑动如何解决?

overflow 子内容滑动,body也跟着滑动如何解决?

代码如下

<!DOCTYPE html>
<html>
<head>
    <title></title>
    <style type="text/css">
    .fixed{
        position: fixed;
        height: 300px;
        width: 300px;
        background-color: red;
        overflow-y: scroll;
        top: 0px;
    }
    .inner_content {
        height: 3000px;
    }
    .container {
        height: 5000px;
    }
    </style>
</head>
<body>
    <div class="container"></div>
    <div class="fixed">
        <div class="inner_content"></div>
    </div>
</body>
</html>

如何能做到,红色容器内容滑动的时候body容器不滑动,不是很明白


Body容器不滑动是什么意思?
网页最右边的滚动条不动吗?


.container {
    height: 5000px;
}

你的container高度设置这么高肯定会滚动的。觉得你的布局有点问题
不想滚动的,body需要

body{
    overflow:hidden;
}
【热门文章】
【热门文章】