Complete the code to apply a CSS class to a Svelte component.
<button class="[1]">Click me</button>
The class attribute applies CSS classes to elements. Here, btn-primary is a class name for styling.
Complete the code to bind a CSS variable in a Svelte style block.
<style>
:root {
--main-color: [1];
}
</style>CSS variables are set with values like colors. Here, #ff0000 sets the main color to red.
Fix the error in the Svelte component to apply conditional styling.
<button class:active=[1]>Toggle</button>
In Svelte, class:active={isActive} applies the active class when isActive is true.
Fill both blanks to create a responsive grid layout in Svelte style.
<style>
.grid {
display: [1];
grid-template-columns: repeat([2], 1fr);
}
</style>To create a grid layout, use display: grid; and set columns with repeat(3, 1fr) for three equal columns.
Fill all three blanks to style a button with hover effect in Svelte.
<style>
button {
background-color: [1];
color: [2];
}
button:hover {
background-color: [3];
}
</style>The button has a blue background #007BFF, white text #ffffff, and a darker blue hover #0056b3 for a polished look.