CSS不允许滚动
在当前形式下,下面的CSS不允许我的页面滚动。但是,如果我禁用下面的CSS代码,该页面允许滚动。我尝试过反复设置overflow
属性,并且使用height: 130%
可以看到滚动条,但该页面实际上并没有滚动。CSS不允许滚动
这是一个JSFiddle显示我的问题。
h1{
color: #FFF;
}
h3{
font-size: 25px;
color: #990000;
text-decoration: none;
font-family: 'Chivo';
}
h5 {
color: #bb0000;
text-decoration: none;
font-family: 'Chivo';
font-size: 40px;
line-height: 1em;
font-weight: bold;
}
h5:focus {
outline: thin dotted rgb(51, 51, 51);
outline-width: thin;
outline-style: dotted;
outline-color: rgb(51, 51, 51);
outline-offset: -2px;
}
h5:hover, a:active {
text-decoration: underline;
color: #990000;
outline: 0;
outline-color: initial;
outline-style: initial;
outline-width: 0px;
}
/*box!*/
#boxdrop{
box-shadow: 0px 0px 10px grey;
position:fixed;
background-attachment:scroll;
left:10px;
}
#boxdrop2{box-shadow: 0px 0px 10px grey;}
.boxbg { background-color:#ccc;background-attachment:scroll; }
.boxbg2 { background-color:#ddd; background-attachment:scroll;}
.boxbg3 { background-color:#eee;background-attachment:scroll;}
.all-round {
border-radius:1em;
-moz-border-radius:1em;
-webkit-border-radius:1em;
}
如果你希望得到的回卷,从您的boxdrop DIV删除position:fixed
。
#boxdrop{
box-shadow: 0px 0px 10px grey;
background-attachment:scroll;
left:10px;
}
我认为这个问题是你的HTML。您有两个div
s,其编号为boxdrop2
。此外,您的div
与编号boxdrop
具有position:fixed
属性,因此div
无法以任何方式滚动。无论何时使用fixed,都会消除滚动的可能性,因为固定元素会离开页面中的元素流。
2个div有意使得圆角矩形 – INdek 2013-03-14 22:01:31
在这种情况下,请使用'class'。 ID仅用于1个元素。此外,您可以在CSS3中使用新的'border-radius'属性来制作圆角矩形。 (有关更多信息,请参阅http://www.w3schools.com/css3/css3_borders.asp。) – 2013-03-14 22:05:10
提供jsfiddle广告更多详情 – 2013-03-14 21:39:31
@ Floradu88我没有更多的细节给我真的卡住 – INdek 2013-03-14 21:51:22
你想滚动哪个元素,并在哪个方向? – isherwood 2013-03-14 21:54:58