gpt4 book ai didi

angular - 如何更改 ngb-tabset 类型 ="pills"的颜色?

转载 作者:行者123 更新时间:2023-12-04 18:19:38 25 4
gpt4 key购买 nike

我正在使用 angular 6 和 ng-bootstrap。我想改变<ngb-tabset type="pills">的背景颜色

.nav-fill .nav-link.active {
margin-top: -1px;
border-top: 2px solid #20a8d8;
}

.nav-pills .nav-link.active, .nav-pills .show > .nav-link {
color: #fff;
background-color: #20a8d8;
}

我无法覆盖 component.scss 中的那些即使我使用 !important这些是内联样式。我不知道它们位于何处,搜索了整个项目都找不到它们。

最佳答案

由于药丸位于子组件( NgbTabset )中,因此您必须使用 shadow-piercing descendant combinator应用样式。目前,Angular 推荐使用 ::ng-deep :

::ng-deep .nav-fill .nav-link.active {
margin-top: -1px;
border-top: 2px solid #20a8d8;
}

::ng-deep .nav-pills .nav-link.active,
::ng-deep .nav-pills .show > .nav-link {
color: #fff;
background-color: #20a8d8;
}

this stackblitz用于演示。

关于angular - 如何更改 ngb-tabset 类型 ="pills"的颜色?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52132154/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com