Bootstrap 4:根颜色显示无效的属性值

问题描述 投票:0回答:2

我试图使用bootstrap 4:根颜色属性,但我得到错误invalid property value

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

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

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

也不是我在netbeansenter 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 bootstrap-4
2个回答
1
投票

你的语法有误。试试这个:

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

另外,:root选择器(或伪类)没有自带引导程序4,它是一个内置的CSS功能。你可以在this documentation上阅读更多相关信息。简而言之,它指的是文档的根元素。总而言之,您正在为文档的根元素定义CSS variables,它与bootstrap无关。

此外,Netbeans还没有实现对CSS变量的支持,here


1
投票

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

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

但是:ぁzxswい

另请注意:Netbeans目前不支持CSS变量。 https://www.codeply.com/go/I2WpYQe8oG


相关:Netbeans show css variables as error

© www.soinside.com 2019 - 2024. All rights reserved.