[英]Linear gradient not being displayed with full color-stop
Hi I am trying to add a linear-gradient on an element with a full color-stop when it reaches 50% of the element but nothing seems to be displayed. 嗨,我正在尝试在元素达到元素的50%但没有任何显示的情况下在元素上添加线性渐变并使用全彩色停止。
I created an example in codepen: 我在Codepen中创建了一个示例:
https://codepen.io/anon/pen/mwaGQW https://codepen.io/anon/pen/mwaGQW
This is the code I am using for adding the background image: 这是我用来添加背景图像的代码:
background-image: linear-gradient(to right, color-stop(50%, #94A14E), color-stop(50%, #C5C5C5));
Can anyone tell me what am I doing wrong? 谁能告诉我我在做什么错?
Here is a working snippet, correct syntax is 'linear-gradient(to right,#94A14E 50%, #C5C5C5)'
这是一个有效的代码段,正确的语法是
'linear-gradient(to right,#94A14E 50%, #C5C5C5)'
(function() { let element = document.querySelector('.ceva'); element.style.backgroundImage = 'linear-gradient(to right,#94A14E 50%, #C5C5C5)' })()
.ceva { width:300px; height:300px; }
<div class="ceva"></div>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.