Recall & Review
beginner
What does it mean that styles are scoped by default in Svelte?
It means CSS inside a Svelte component only applies to that component's HTML, not to other parts of the page. This keeps styles isolated and avoids conflicts.
Click to reveal answer
intermediate
How does Svelte achieve scoped styles without extra syntax?
Svelte automatically adds unique attributes to elements and matches CSS selectors to those attributes, so styles only affect elements in that component.
Click to reveal answer
beginner
Can styles in one Svelte component affect elements in another component by default?
No. By default, styles are scoped, so they do not leak outside the component they are written in.
Click to reveal answer
intermediate
How can you write global styles in a Svelte project if styles are scoped by default?
You can use the <style> tag with the global attribute, like <style global>, to write CSS that applies globally.
Click to reveal answer
beginner
Why are scoped styles helpful when building user interfaces?
Scoped styles prevent style conflicts, making components reusable and easier to maintain, just like keeping your clothes separate so colors don’t mix.
Click to reveal answer
In Svelte, what happens to CSS inside a component's <style> tag by default?
✗ Incorrect
By default, Svelte scopes styles to the component, so CSS applies only to that component's elements.
How can you write CSS that affects the whole app in Svelte?
✗ Incorrect
Using