Warm tip: This article is reproduced from serverfault.com, please click

Overriding the encapsulated CSS of external component

发布于 2016-10-21 13:33:07

I was wondering how to override the encapsulated CSS of an external component.

So I am using material2 in my project and the tabs component has a the attribute overflow set on tab-body. Is it possible to override the overflow value?

Questioner
Salma Hamed
Viewed
0
10.2k 2018-10-16 00:30:04

You can use the special css /deep/ instruction. See the documentation

So, if you have

app
  sub-component
    target-component
      <div class="target-class">...</div>

You can put in your apps css (or less):

/deep/ .target-class {
  width: 20px;
  background: #ff0000;
}

Obviously, you can put this css fragment in sub-component as well.