【发布时间】:2018-12-25 18:13:24
【问题描述】:
在以下示例中,我有一个 Bootstrap 按钮样式,它被 Kendo-UI 的 .k-grid 设置的 color: inherit 条目劫持:
.k-grid a {
color: inherit;
}
<div class="k-grid">
<a class="btn btn-secondary" href="#">Button</a>
</div>
在这里演示:http://jsfiddle.net/aq9Laaew/299912/
您可以观察到.k-grid a 的inherit 属性绕过传递给a 标记的任何其他类。最终,Bootstrap Button 在 Kendo-grid 表格中显示为错误的颜色。
解决此问题的正确方法是什么?我不确定在 Bootstrap 的 SASS 中添加!important 是不是最好的解决方案。
【问题讨论】:
-
请发minimal reproducible example,以便我们进行实验和调试。
-
因为 CSS 意味着 CascadeStyleSheet。而
.k-grid a比.btn-sm具有更大的“价值”。更多选择器 = 更多价值 -
在 CSS 中,有一个“值”取决于此样式在“外部文件/内联/嵌入(
-
@csmckelvey 我用一个最小、完整和可验证的例子编辑了我的问题。
标签: css twitter-bootstrap kendo-grid css-specificity