问题描述
这是浏览器呈现的内容:
元素super-tabs
是library。我想从根组件向类.buttons-container
添加样式
这是我正在尝试的方法,但是不起作用:
@media (min-width: 768px) {
:host ::ng-deep super-tabs-toolbar .buttons-container {
margin: 0;
padding-right: calc((100% - 1080px) / 2);
padding-left: calc((100% - 1080px) / 2);
}
}
解决方法
添加!important
来覆盖现有的CSS属性,如下所示:
@media (min-width: 768px) {
:host ::ng-deep super-tabs-toolbar .buttons-container {
margin: 0 !important;
padding-right: calc((100% - 1080px) / 2) !important;
padding-left: calc((100% - 1080px) / 2) !important;
}
}