Bird
0
0

In Angular, what is the main difference between inline styles and external styles in a component?

easy📝 Conceptual Q1 of 15
Angular - Components
In Angular, what is the main difference between inline styles and external styles in a component?
AInline styles require importing CSS files, external styles do not.
BInline styles are global, external styles apply only to the component.
CInline styles are defined inside the component decorator, external styles are in separate CSS files.
DInline styles cannot use CSS selectors, external styles can.
Step-by-Step Solution
Solution:
  1. Step 1: Understand inline styles location

    Inline styles are written directly inside the component decorator using the styles property.
  2. Step 2: Understand external styles location

    External styles are placed in separate CSS files and linked using the styleUrls property in the component decorator.
  3. Final Answer:

    Inline styles are defined inside the component decorator, external styles are in separate CSS files. -> Option C
  4. Quick Check:

    Inline vs external styles location = A [OK]
Quick Trick: Inline styles go inside decorator, external in separate files [OK]
Common Mistakes:
  • Thinking inline styles are global
  • Confusing import requirements
  • Believing inline styles can't use selectors

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Angular Quizzes