css - Bootstrap 4 :root color displays invalid property value

标签 css bootstrap-4

我尝试使用 bootstrap 4 :Root color property 但我得到错误 invalid property value

我还检查了 bootstrap 文档,但一无所获。

有人可以帮助我如何使用 bootstrap 4 :root property

检查下面我试图实现但失败的片段。

我在 netbeans 中也没有得到错误 enter image description here

提前致谢

:root {
  --blue: #007bff;
  --indigo: #6610f2;
  --purple: #6f42c1;
  --pink: #e83e8c;
  --red: #dc3545;
  --orange: #fd7e14;
  --yellow: #ffc107;
  --green: #28a745;
  --teal: #20c997;
  --cyan: #17a2b8;
  --white: #fff;
  --gray: #6c757d;
  --gray-dark: #343a40;
  --primary: #007bff;
  --secondary: #6c757d;
  --success: #28a745;
  --info: #17a2b8;
  --warning: #ffc107;
  --danger: #dc3545;
  --light: #f8f9fa;
  --dark: #343a40;
  --breakpoint-xs: 0;
  --breakpoint-sm: 576px;
  --breakpoint-md: 768px;
  --breakpoint-lg: 992px;
  --breakpoint-xl: 1200px;
}

.frm-input:focus {
  border-color: --yellow;
}
<div class="frm-row">
  <input class="frm-input" type="text" name="email" placeholder="Email address">
</div>

最佳答案

这些是 CSS variables .使用 var(--..) 引用它们。在您的情况下,它将是:

.frm-input:focus {
  border-color: var(--yellow);
}

演示:https://codeply.com/go/I2WpYQe8oG

另请注意:Netbeans 目前不支持 CSS 变量。 Netbeans show css variables as error


相关:CSS use color from another class?

关于css - Bootstrap 4 :root color displays invalid property value,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52018347/

相关文章:

javascript - bootstrap 4 的 bootstrap-datetimepicker

javascript - Bootstrap 工具提示不会在 <a> 标签点击时隐藏

html - 在 css 中使用 div 作为剪贴蒙版

jquery - 动态加载图像作为 Canvas 背景。我该怎么做?

html - 仅使用 CSS 向下滑动并在页面加载时停止

css - Bootstrap 4.0 - 两个 NavBar 合二为一

javascript - 在javascript中设置 margin 日历

html - 如何将旋转的 div 置于具有特定宽度的表格元素内居中?

css - 三列溢出布局

html - css 不适用于没有 href 属性的标签