visual-studio-code - 还定义标准属性 'grid-row' 以实现兼容性

标签 visual-studio-code grid warnings

我在 VS Code 上收到以下警告

"Also define the standard property 'grid-row' for compatibility"

对于此代码:

header {
  -ms-grid-row: 1;       /* warning here */
  -ms-grid-column: 1;    /* warning here */
  -ms-grid-column-span: 2;
  grid-area: header;
}

如何修复它?

最佳答案

如果您愿意,您可以通过将此设置设置为忽略来摆脱它:

CSS > Lint: Vendor Prefix

  When using a vendor-specific prefix, also include the standard property.

您收到警告是因为您使用了这些键中的一个或多个

-ms-grid-row
-ms-grid-column

在您的元素中,同时不使用标准的无前缀版本:

grid-row
grid-column

因此,在具有 -ms-grid-row 的每个元素中,在同一个选择器中的后面还包含 grid-row ,并且与 相同-ms-grid-column 在同一个选择器中在其后面放置一个grid-column。并且警告将会消失。无论如何,这是一个很好的做法。例如:

header {
  -ms-grid-row: 1;   /* warning has gone away */
  grid-row: 1;

  -ms-grid-column: 1;
  -ms-grid-column-span: 2;

  grid-column: 2;
  grid-area: header;
}

或者将 CSS > Lint: Vendor Prefix 设置为 ignore,您将不会看到警告 - 但我不建议这样做。您应该包含这些 key 的标准无前缀版本。

关于visual-studio-code - 还定义标准属性 'grid-row' 以实现兼容性,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62084963/

相关文章:

html - 如何让按钮横跨水平与堆叠并在移动设备上使它们占 50%(2 x 2)?

c - 可疑指针转换警告

php - 被 heredoc 破坏的 VS 代码的语法高亮显示

python - 如何在 VSCode 中加载 Python 交互窗口时运行启动命令

visual-studio-code - VSCode - 复制当前行的快捷方式

javascript - 在 HTML 表中显示对象 ng-repeat - Angular

node.js - VS Code 集成终端抛出 `Cannot find module` & `nvm is not compatible with the npm config "前缀”选项`

angularjs - AngularJS 有没有类似 excel 的网格解决方案

c - 警告 : implicit declaration of function — why does my code work anyway?

haskell - 为什么我会从 GHCi 收到此警告?