Recall & Review
beginner
What does the
transition:fade directive do in Svelte?It smoothly changes the opacity of an element when it enters or leaves the DOM, creating a fading effect.
Click to reveal answer
beginner
How do you apply a fade transition to an element in Svelte?
Add
transition:fade inside the element's tag, like <div transition:fade>...</div>.Click to reveal answer
intermediate
Can you customize the duration of the fade transition in Svelte? How?
Yes, by passing an object with options like
{ duration: 500 } to fade, e.g., transition:fade={{ duration: 500 }}.Click to reveal answer
beginner
What happens if you remove an element with
transition:fade applied?The element fades out smoothly before it is removed from the DOM.
Click to reveal answer
beginner
Why is using
transition:fade better than instantly hiding elements?Because it creates a smooth visual effect that is easier on the eyes and improves user experience by showing changes clearly.
Click to reveal answer
What does
transition:fade control in Svelte?✗ Incorrect
transition:fade changes the opacity smoothly when elements appear or disappear.
How do you specify a 1-second fade duration in Svelte?
✗ Incorrect
You pass an object with duration in milliseconds inside double curly braces.
When does the fade-out effect happen?
✗ Incorrect
The fade-out happens as the element leaves the DOM, making it disappear smoothly.
Which import is needed to use
fade in Svelte?✗ Incorrect
You must import fade from svelte/transition to use it.
What is the default duration of
fade transition if not specified?✗ Incorrect
The default fade duration in Svelte is 400ms if you don't set it.
Explain how to add a fade transition to an element in Svelte and customize its duration.
Think about the directive syntax and import statement.
You got /3 concepts.
Describe what happens visually when an element with transition:fade is removed from the page.
Focus on the fade-out behavior.
You got /3 concepts.