我怎样才能删除节点的高亮颜色

问题描述 投票:1回答:2

我有一个PrimeNg树(角2),我想删除所选的节点高亮颜色。

Image Here

基于图像我要删除的蓝色高亮颜色。

相反,我想这种风格:Style I want

这里是我的风格:

.ui-tree {
  width: 100%;
}

body .ui-widget-content {
  border: none !important;
}

span.ui-treenode-label {
  font-family: Poppins !important;
  line-height: 24px !important;
  font-size: 14px !important;
  padding-left: 5px !important;
  padding-right: 5px !important;
}

span.ui-treenode-icon {
  line-height: 24px !important;
  font-size: 1.2rem !important;
}

.ui-tree .ui-chkbox .ui-chkbox-icon {
  margin-left: 0px;
}

.ui-tree .ui-treenode-children {
  padding-left: 20px !important;
}

.hidden-tree-node {
  display: none;
}

.ui-state-highlight .ui-widget-content {
  color: white;
}
css primeng
2个回答
0
投票

您可以通过设置覆盖了原有的风格:

span.ui-state-highlight {
    background-color: transparent !important;
    color: inherit !important;
}

0
投票

有几个解决方案:

1)使用深

::ng-deep {
  span.ui-state-highlight {
    background-color: transparent;
    color: inherit;
  }
}

2)目标在一个更具体的方式的元件

span.ui-treenode-label.ui-corner-all.ui-state-highlight {
   background-color: transparent;
   color: inherit;
}

另外,尽量使用SASS。它会使你的CSS可读性更强,更聪明。你会喜欢的。顺便说一句,你应该从你的代码中删除的重要性。使用importants是不是好的做法。

© www.soinside.com 2019 - 2024. All rights reserved.