2014-12-25 43 views
-1

我想在我的index.html而不是其他页面中禁用滚动选项。如何禁用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** } 

我也tride这样的:

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

背景:-moz-线性渐变(左,RGBA(169 ,3,41,1)0%,rgba(143,2,34,1)44%,rgba(109,0,25,1)100%); 012g背景:-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-linear-gradient(左,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%; }

但是,这使我的背景科洛尔dissapear和applys我所有的网页...

+0

我也很高兴,如果我可以改变的高度我的index.html这种方式滚动woudnt是可能的是吗? –

+5

告诉我们你到目前为止尝试过的。你的问题太广泛了。编辑你的问题,并添加你的相关HTML/CSS和你已经尝试到目前为止 – Banana

+0

你想禁用页面上的滚动 –

回答

0

溢出-Y:隐藏;/*使用此隐藏垂直滚动*/

overflow-x:auto;/*使用此/

例子来说明水平滚动*:

html, body { 
    overflow-y:hidden; 
} 
+0

请注意,溢出x/y是css3的功能,并不会在旧版浏览器中工作。 + OP说隐藏不是他的意图。 – Banana

+1

加油!在5天内,我们将在2015年! 99.9999999%的人使用最近的浏览器!谁在2014年使用ie6 ???????? –

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** 
    } 
+0

这项工作,但我的背景科罗拉多消失...这发生在我所有的页面我只索引 –

+0

你发布此代码页你想禁用滚动尝试我的代码做了一些修改 –

+0

我使用CSS,所以这个工作对于我 –

相关问题