有没有办法让渐变背景的每次交替重复都反转?目前我有以下 CSS:
html {
background: white; /* For browsers that do not support gradients */
background: -webkit-linear-gradient(blue, white); /* For Safari 5.1 to 6.0 */
background: -o-linear-gradient(blue, white); /* For Opera 11.1 to 12.0 */
background: -moz-linear-gradient(blue, white); /* For Firefox 3.6 to 15 */
background: linear-gradient(blue, white); /* Standard syntax */
background-size: cover;
height: 100%;
}
body {
height: 100%;
}
<html>
<head>
</head>
<body
Hello world
</body>
</html>
目前,它从上到下从蓝色变为白色,但当我向下滚动时,它再次从蓝色变为白色,例如。 蓝色->白色;蓝->白;蓝色->...
。我希望它从 blue -> white -> blue -> white ->...
开始。
最佳答案
您可以使用 repeating-linear-gradient
实现如下:
html {
background: white;
background: repeating-linear-gradient(blue, white 100vh, white 100vh, blue 200vh);
height: 1980px;
}
body {
height: 100%;
margin: 0;
}
关于html - CSS:反向重复线性渐变,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38866614/