littlecharva
8
html
css
我有需要扩大宽度和高度的HTML页面,所以需要能够上下滚动和左右,但我似乎无法得到的CSS梯度重复-X和向下留下了坚实的颜色.
剥离代码:
/p>
“http://www.w3.org/TR/html4/loose.dtd”>
html {
height: 100%;
background-color: #366fcd; }
body {
margin: 0;
height: 100%;
width: 100%;
background-color: #366fcd;
background: -moz-linear-gradient(center top, # 0%,#366fcd 100%);
background: -webkit-gradient(linear, left top, left bottom, color-stop(0, #),color-stop(1, #366fcd));
background-repeat: repeat-x;
}
div#TheElement {
position: absolute;
width: 100px;
height: 100px;
background-color: #fff;
left: 2000px;
top: 2000px;
}
当您向下滚动时,这会将渐变运行为纯色(#366fcd),但是当您向右滚动时,渐变会停止,您也会看到纯色. 见例子.
如果我删除背景颜色:#366fcd; }从HTML元素,那么沿x轴的梯度重复如预期的,但在向下滚动时,梯度停止和白色出现. 见例子.
我知道我总是可以使用背景图像,但更喜欢让CSS工作.
哦,是的,这是在OSX Lion的Chrome和FF上测试的.
安东尼
发布者:全栈程序员-站长,转载请注明出处:https://javaforall.net/210992.html原文链接:https://javaforall.net
