如何在index.html中禁用滚动而不是其他页面

时间:2014-12-25 15:09:46

标签: html css scroll

我想在index.html中禁用滚动选项而不是其他页面。

我试图隐藏它,但那不是我想要的。

我在我的CSS中有这个,但它只隐藏了滚动条:

body {background: rgba(169,3,41,1); background: -moz-linear-gradient(left, rgba(169,3,41,1) 0%, rgba(143,2,34,1) 44%, rgba(109,0,25,1) 100%); background: -webkit-gradient(left top, right top, color-stop(0%, rgba(169,3,41,1)), color-stop(44%, rgba(143,2,34,1)), color-stop(100%, rgba(109,0,25,1))); background: -webkit-linear-gradient(left, rgba(169,3,41,1) 0%, rgba(143,2,34,1) 44%, rgba(109,0,25,1) 100%); background: -o-linear-gradient(left, rgba(169,3,41,1) 0%, rgba(143,2,34,1) 44%, rgba(109,0,25,1) 100%); background: -ms-linear-gradient(left, rgba(169,3,41,1) 0%, rgba(143,2,34,1) 44%, rgba(109,0,25,1) 100%); background: linear-gradient(to right, rgba(169,3,41,1) 0%, rgba(143,2,34,1) 44%, rgba(109,0,25,1) 100%); filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#a90329', endColorstr='#6d0019', GradientType=1 ); **overflow: hidden** }

我也是这样说的:

body {background: rgba(169,3,41,1);

背景:-moz-linear-gradient(左,rgba(169,3,41,1)0%,rgba(143,2,34,1)44%,rgba(109,0,25,1) 100%); 背景:-webkit-gradient(左上,右上,颜色停止(0%,rgba(169,3,41,1)),颜色停止(44%,rgba(143,2,34,1)) ,颜色停止(100%,rgba(109,0,25,1))); 背景:-webkit-linear-gradient(左,rgba(169,3,41,1)0%,rgba(143,2,34,1)44%,rgba(109,0,25,1)100%) ; 背景:-o-linear-gradient(左,rgba(169,3,41,1)0%,rgba(143,2,34,1)44%,rgba(109,0,25,1)100%) ; 背景:-ms-线性梯度(左,rgba(169,3,41,1)0%,rgba(143,2,34,1)44%,rgba(109,0,25,1)100%) ; 背景:线性梯度(右,rgba(169,3,41,1)0%,rgba(143,2,34,1)44%,rgba(109,0,25,1)100%); filter:progid:DXImageTransform.Microsoft.gradient(startColorstr ='#a90329',endColorstr ='#6d0019',GradientType = 1); 位置:固定;     overflow-y:scroll;     宽度:100%; }

但这会使我的背景颜色消失并适用于我的所有页面......

2 个答案:

答案 0 :(得分:0)

溢出-γ:隐藏; / *用于隐藏垂直滚动* /

溢出 - X:汽车; / *使用此选项显示水平滚动* /

示例:

html, body {
    overflow-y:hidden;
}

答案 1 :(得分:0)

CSS3

停止滚动的简单方法
    body
    {
        position: fixed; 
        overflow-y: scroll;
        width: 100%;
background: rgba(169,3,41,1);
background: -moz-linear-gradient(left, rgba(169,3,41,1) 0%, rgba(143,2,34,1) 44%, rgba(109,0,25,1) 100%);
background: -webkit-gradient(left top, right top, color-stop(0%, rgba(169,3,41,1)), color-stop(44%, rgba(143,2,34,1)), color-stop(100%, rgba(109,0,25,1)));
background: -webkit-linear-gradient(left, rgba(169,3,41,1) 0%, rgba(143,2,34,1) 44%, rgba(109,0,25,1) 100%);
background: -o-linear-gradient(left, rgba(169,3,41,1) 0%, rgba(143,2,34,1) 44%, rgba(109,0,25,1) 100%);
background: -ms-linear-gradient(left, rgba(169,3,41,1) 0%, rgba(143,2,34,1) 44%, rgba(109,0,25,1) 100%);
background: linear-gradient(to right, rgba(169,3,41,1) 0%, rgba(143,2,34,1) 44%, rgba(109,0,25,1) 100%);
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#a90329', endColorstr='#6d0019', GradientType=1 );
**overflow: hidden**
    }