简体   繁体   English

将线性渐变应用于背景

[英]Apply linear gradient to background

I have been trying to apply linear gradient to the background, but there are stripes that appear in the middle I'm not getting a smooth gradient, how to get a smooth gradient from top to bottom 我一直试图在背景中应用线性渐变,但是中间出现条纹我没有得到平滑渐变,如何从上到下获得平滑渐变

MY CSS 我的CSS

-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
background-size: cover;
background: #DADADA;
background-repeat: no-repeat;
background: -webkit-linear-gradient(white, #DADADA);
background: -moz-linear-gradient(white, #DADADA);
background: -ms-linear-gradient(white, #DADADA);
background: -o-linear-gradient(white, #DADADA);

My Fiddle : https://jsfiddle.net/3njyc0xm/ 我的小提琴: https//jsfiddle.net/3njyc0xm/

Yes, I think there is a problem with "your" colors. 是的,我认为“你的”颜色存在问题。 I have tried your code with other colors, and there is no problem. 我已尝试使用其他颜色的代码,没有问题。

I have tried your jsfiddle gradient in Firefox and Edge, and it seems that there is no problem with your colors, so maybe there is a Chrome bug, or something. 我在Firefox和Edge中尝试过你的jsfiddle渐变,看起来你的颜色没有问题,所以可能有一个Chrome bug,或者其他东西。

In Firefox your example works fine, but I think the "normal" CSS property is needed for some browsers. 在Firefox中,您的示例工作正常,但我认为某些浏览器需要“正常”的CSS属性。 Just add it with 只需添加它

background: linear-gradient(white, #DADADA);

I edited your fiddle here 在这里编辑你的小提琴

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM