Angular-在阴影根中向类添加样式

问题描述

这是浏览器呈现的内容:

enter image description here

元素super-tabslibrary。我想从根组件向类.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;
  }
}

相关问答

错误1:Request method ‘DELETE‘ not supported 错误还原:...
错误1:启动docker镜像时报错:Error response from daemon:...
错误1:private field ‘xxx‘ is never assigned 按Alt...
报错如下,通过源不能下载,最后警告pip需升级版本 Requirem...