[英]Linear gradient as body background of first full-screen-view; after that solid bg color
My goal is to have a gradient gradually turning from white into blue from top to bottom.我的目标是让渐变从上到下逐渐从白色变为蓝色。 If I open the page, the final blue tone should be reached at the lower edge of my screen.
如果我打开页面,最终的蓝色调应该在我的屏幕下边缘达到。 If I scroll down any further, the final blue tone should consistently stay as a solid background color.
如果我进一步向下滚动,最终的蓝色调应该始终保持为纯色背景色。 How can I achive this in the simplest way possible?
我怎样才能以最简单的方式实现这一目标? Old browser support is not important.
旧浏览器支持并不重要。
This version isn't working because the gradient loops every screen-height:此版本不起作用,因为渐变会循环每个屏幕高度:
background: linear-gradient(0deg, blue 51%, white 100%);
You can do like below:您可以执行以下操作:
html { background: linear-gradient(0deg, blue 51%, white) top/100% 100vh no-repeat blue; }
<div style="height:2000px"></div>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.