Bird
0
0

In Angular, where do you place inline styles for a component?

easy📝 Conceptual Q11 of 15
Angular - Components
In Angular, where do you place inline styles for a component?
AInside the <code>styleUrls</code> array in the component decorator
BIn the global styles.css file
CInside the <code>styles</code> array in the component decorator
DInside the <code>template</code> property of the component
Step-by-Step Solution
Solution:
  1. Step 1: Understand Angular component decorator properties

    The styles property is used to define inline CSS styles directly inside the component decorator.
  2. Step 2: Differentiate between styles and styleUrls

    styleUrls is used for external CSS files, not inline styles.
  3. Final Answer:

    Inside the styles array in the component decorator -> Option C
  4. Quick Check:

    Inline styles = styles property [OK]
Quick Trick: Inline styles go in styles, external in styleUrls [OK]
Common Mistakes:
  • Confusing styles with styleUrls
  • Placing inline styles in global styles.css
  • Trying to put styles inside template

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Angular Quizzes