我想让我的网站的背景变色到一半.
它应该会褪色到另一种 colored颜色 .我怎么能这么做呢?
网站顶部为绿色,中途变为蓝色,如下所示:
我想让我的网站的背景变色到一半.
它应该会褪色到另一种 colored颜色 .我怎么能这么做呢?
网站顶部为绿色,中途变为蓝色,如下所示:
超级简单,使用linear-gradient()
,还加上background-attachment:fixed;
,以确保渐变不会重复.
body {
background-image: linear-gradient(#d3ff6e, #00faff); /* customize colors here */
background-attachment: fixed;
}
<html>
<body></body>
</html>
如果要使黄色更明显一些,请在 colored颜色 后面添加一个百分比,如下所示:
body {
background-image: linear-gradient(#d3ff6e 35%, #00faff); /* customize colors here */
background-attachment: fixed;
}
<html>
<body></body>
</html>