我想知道是否有可能修复来自html标签的渐变:

html, body, .wrapper {
    height: 100%;
}
body > .wrapper {
    height: 100%;
    min-height: 100%;
}

html {
    font-family: Arial, Helvetica, sans-serif;
    font-size: 14px;
    background-attachment: fixed !important;
    background-image: green;
    background-image: -webkit-gradient(linear, 0 0, 0 100%, from(green), color-stop(20%, #fff), color-stop(80%, #fff), color-stop(100%, green));
    background-image: -webkit-linear-gradient(left, green, #fff 20%, green 100%);
    background-image: -moz-linear-gradient(left, green, #fff 20%, green 100%));
    background-image: -o-linear-gradient(left, green, #fff 20%, green 100%));
    background-image: -ms-linear-gradient(left, green, #fff 20%, green 100%));
    background-image: linear-gradient(left, green, #fff 20%, green 100%));

}


因此,当您调整浏览器窗口的大小时,渐变不会移动。

这可能吗?

非常感谢。

最佳答案

将其设置为特定的px值:

background: linear-gradient(to right, green 0%, #fff 300px, green 100%);


http://jsfiddle.net/GuMKd/

考虑使用此工具:http://www.colorzilla.com/gradient-editor/

关于html - 如何固定渐变背景?,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/15365844/

10-13 01:01