简体   繁体   English

线性渐变作为第一个全屏视图的主体背景; 在那坚实的bg颜色之后

[英]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.

相关问题 如何检查背景是渐变色还是纯色 - how to check if a background is a gradient or a solid color 如何将主体的背景颜色更改为线性渐变颜色 - how can i change background-color of the body to a linear gradient color Javascript画布线性渐变不会全彩色 - Javascript canvas linear gradient not going to full color 一段时间后改变线性渐变背景 - Change linear gradient background after a time 单击GO按钮后,如何将背景色更改为线性渐变,并在输入标签中输入颜色并进行混合? - How to change background color to linear gradient with colors entered in the input tags and mixed after clicking GO button? DOM背景颜色传播闪烁继承Google Chrome中的初始bg颜色,使用主题切换来超载body bg颜色 - DOM Background color propagation flickering inheriting initial bg color in Google Chrome using theme toggle to overload body bg color 如何更改body的CSS:在以线性渐变影响色标之前? - How to change the css of body:before to affect color stop in a linear gradient? 如何使用淡入效果更改线性渐变的主体背景 - How to change body's background for a linear gradient using a fade in effect 身体背景图片无法全屏显示 - Body Background image cannot full screen 如何使用函数来改变线性渐变的背景颜色? - How to use a function to change background color with linear gradient?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM