我可能有点晚了,但我找到了一个解决方法。我将其添加到CSS页面中,然后检查元素。
例如:对于*背景:linear-gradient(to right, #000 0%,#000 50%,#fff 50%#fff 100%)*; 如果您使用检查元素检查它,您会发现:
-webkit-gradient(linear, left top, right top, from(#000), color-stop(50%, #000), color-stop(50%, #fff))。
因此,只需在您的React组件的内联样式中添加此最后一行即可。
<div className="card" style={{background:"-webkit-gradient(linear, left top, right top, from(#000), color-stop(50%, #000), color-stop(50%, #fff))"}}/>
为了我的示例,我使用了上面的这个而不是:
<div className="card" style={{background: linear-gradient(to right, #000 0%, #000 50%, #fff 50% #fff 100%)"}}/>
总之,在css文件中添加这个代码,它会起作用,在“检查元素”中查看输出,并在你的React js组件的内联样式中使用和编辑它。
linear-gradient(to bottom, Transparent 0%,Transparent 50%,red 50%,red 100%
。 - JoSSte