使用!important覆盖CSS内联CSS文件不起作用

时间:2019-04-26 15:37:12

标签: html css datepicker css-selectors

我在我的角度应用程序中使用following control,并且提供了原始的html。我想重写它。

如何为以下类的CSS覆盖内联样式?

<div class="selector selectorarrow selectorarrowleft" tabindex="0" ng-reflect-klass="selector" ng-reflect-ng-class="[object Object]" ng-reflect-ng-style="[object Object]" ng-reflect-value="1" style="width: 252px; height: 232px; top: 33px; left: 0px;"> ... 

预期输出:(已修改top,添加了position

<div class="selector selectorarrow selectorarrowleft" tabindex="0" ng-reflect-klass="selector" ng-reflect-ng-class="[object Object]" ng-reflect-ng-style="[object Object]" ng-reflect-value="1" style="width: 252px; height: 232px; top: 10px; left: 0px; position: relative">

尝试以下操作无效:

.selector.selectorarrow.selectorarrowleft[style] {
  position: relative !important
}

1 个答案:

答案 0 :(得分:1)

我会删除[style]并添加div以使其更具特异性,例如:

div.selector.selectorarrow.selectorarrowleft {
  position: relative !important;
  top: 10px !important;
}
相关问题