我有这个 CSS 规则:
.featured .content-wrapper {
background-color: #7ac0da;
background-image: -ms-linear-gradient(left, #7ac0da 0, #a4d4e6 100%);
background-image: -o-linear-gradient(left, #7ac0da 0, #a4d4e6 100%);
background-image: -webkit-gradient(linear, left top, right top, color-stop(0, #7ac0da), color-stop(1, #a4d4e6));
background-image: -webkit-linear-gradient(left, #7ac0da 0, #a4d4e6 100%);
background-image: linear-gradient(left, #7ac0da 0, #a4d4e6 100%);
color: #3e5667;
padding: 20px 40px 30px 40px;
}
...并且 R# 提示最后一个背景图像行,Expected one of: <angle>, to, <named-color>, <system-color>, <color>, rgb(), rgba(), hsl(), hsla().
不过,我不知道它想要什么 - 我如何修改该行以安抚 R# 有时看起来像的白手套婆婆(不要误会我的意思 - 我爱她,无论如何)?
最佳答案
因为那不是有效的 CSS。引用MDN :
Formal grammar: linear-gradient( [ <angle> | to <side-or-corner> ,]? <color-stop> [, <color-stop>]+ ) \---------------------------------/ \----------------------------/ Definition of the gradient line List of color stops where <side-or-corner> = [left | right] || [top | bottom] and <color-stop> = <color> [ <percentage> | <length> ]?
所以你想要
background-image: linear-gradient(to left, #7ac0da 0, #a4d4e6 100%);
参见 history of the syntax部分说明为什么特定于供应商的版本看起来像他们的样子。
在我的 R# (7.1) 中,特定于供应商的版本都被提示Unknown vendor specific extension 'whatever'
,并且实际上根本没有检查它们的函数参数的有效性。
关于css - 当 R# 提示我的线性渐变时,我需要做什么来安抚它?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18044214/