0

I have a component with Native View Encapsulation

This means that every CSS rule use the shadow DOM to apply my rule only to the current component. But I have a component that every time I use it, I want to style tag. How can I combine Native View Encapsulation with global CSS rules?

3
  • can you clarify your question ? do you want to avoid the use of encapsulation: ViewEncapsulation.None and still be able to style your component with global style ? Commented Apr 25, 2018 at 22:15
  • Exactly! This is what i want Commented Apr 26, 2018 at 4:17
  • you can place the rule in the root styles.css file. personally i use scss @includes. write it once and import it wherever. Commented Feb 8, 2020 at 17:18

1 Answer 1

1

You add the global stylesheet to the styleUrls value in the component so that it's allowed under those circumstances, like so:

styleUrls: ['./products.component.css', '../app.component.css'],

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.