Svelte · Junior · Question 5 of 76
How is CSS in a component's <style> block applied by default?
- ✓Correct answer: It is scoped to that component: Svelte adds a hash class to the elements so styles don't leak out
- 2It is global and affects the whole page
- 3It is ignored unless you import it in
main.js
Explanation
For global rules use :global(...) or a :global { ... } block. Unused selectors produce a compiler warning and are removed from the output.