Bird
0
0

If both define styles for p tags, which styles apply inside the Child component's template?

hard📝 Application Q9 of 15
Angular - Components
You have two components: Parent and Child. Parent uses ViewEncapsulation.Emulated and Child uses ViewEncapsulation.None. If both define styles for p tags, which styles apply inside the Child component's template?
AParent's styles override Child's styles inside Child
BNeither styles apply inside Child component
CChild's styles apply globally, including inside Child
DOnly Parent's styles apply inside Child
Step-by-Step Solution
Solution:
  1. Step 1: Understand Child's None encapsulation effect

    Child's styles apply globally, affecting all matching elements including inside Child.
  2. Step 2: Understand Parent's Emulated encapsulation effect

    Parent's styles are scoped only to Parent component elements, so they don't affect Child.
  3. Final Answer:

    Child's styles apply globally, including inside Child -> Option C
  4. Quick Check:

    None encapsulation styles apply globally [OK]
Quick Trick: None encapsulation styles affect all, Emulated styles are scoped [OK]
Common Mistakes:
  • Assuming Parent styles override Child
  • Thinking styles don't apply inside Child
  • Confusing encapsulation scopes

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Angular Quizzes