css - 当 R# 提示我的线性渐变时,我需要做什么来安抚它?

标签 css resharper background-image linear-gradients

我有这个 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/

相关文章:

visual-studio - Visual Studio 2015 社区 + Resharper 9 : 2 pop-up lists show for intellisense

javascript - Chartist.js 删除标签?

html - IE中带有svg图像的CSS表格布局高度

html - 使用 bootstrap 4,导航菜单不会在中等屏幕的标题下方打开

c# - 使用 Shift+F5 终止运行后返回编码 Pane 的 Visual Studio 快捷方式

resharper - ReSharper 中有查找和替换功能吗?

jQuery:选择列表项,显示文本

html - CSS 背景图像未在我的计算机上显示

jquery - 使用 jQuery 从背景图像获取尺寸

html - 如何引用背景图像?