样式中设置渐变linear-gradient()未起作用,官方不支持?
发布于 5 年前 作者 lsun 6999 次浏览 来自 官方Issues

样式表中,设置元素背景色为渐变色,但真机上无效果,官方不支持编写样式时设置渐变色吗?

尝试很多种都无效果,求真解?

 

background: linear-gradient(180deg, #456FFF 0%, rgba(69,111,255,0.00) 100%);

background: linear-gradient(#e66465, #9198e5);

/* 渐变轴为45度,从蓝色渐变到红色 */
background: linear-gradient(45deg, blue, red);

/* 
从右下到左上、从蓝色渐变到红色
 */
background: linear-gradient(to left top, blue, red);

/* 
从下到上,从蓝色开始渐变、到高度40%位置是绿色渐变开始、最后以红色结束
 */
background: linear-gradient(0deg, blue, green 40%, red);
2 回复

你好,使用的是cover-view?

background:-webkit-linear-gradient()

回到顶部