RRB
RRB

Reputation: 2116

Override css style on local component css file

I am getting the following style in my Chrome browser developer inspector

.footer-content__nav[_ngcontent-ema-c214] li[_ngcontent-ema-c214] a[_ngcontent-ema-c214] {
    color: #fff;
    text-decoration: none;
}

This style is set elsewhere in my application however I just need to change the style color for a specific component so I do not want to change it on the global component.

Here is the global component

TS

selector: 'app-page-footer',

CSS

.footer-content__nav {

      li {
        padding: 0 10px;
    
        a {
          color: $white;
          text-decoration: none;
          &:hover,
          &:focus {
            color: $dark;
          }      
        }
    
      }
    }

HTML

<ul class="footer-content__nav">
  <li>
    <a>...
    </a>
  </li>
</ul>

Here is my local component

CSS

.footer-content__nav {

  li {
    padding: 0 10px;

    a {
      color: $dark;
      text-decoration: none;
      &:hover,
      &:focus {
        color: $dark;
      }      
    }

  }
}

HTML

<app-page-footer></app-page-footer>

Is there a way I can achieve this? Right now my local style doesn't even show up in the Chrome dev tools styles.

Upvotes: 0

Views: 197

Answers (1)

Aaron
Aaron

Reputation: 11

The global CSS style will always override the local one, so I think you could just delete either one depending on the color you want

Upvotes: 1

Related Questions