Complete the code to import a CSS module in an Astro component.
import styles from './Button.module.css'; export default function Button() { return <button className={styles.[1]>Click me</button>; }
The CSS class btn is imported from the CSS module and used as styles.btn to style the button.
Complete the code to apply multiple CSS module classes to an element in Astro.
<div className={`${styles.container} [1]`}>Content</div>Using template literals, multiple CSS module classes can be combined. Here, styles.container and styles.main are applied.
Fix the error in the Astro component to correctly use CSS modules for styling.
import styles from './Card.module.css'; export default function Card() { return <section className=[1]>Card content</section>; }
The correct way to apply a CSS module class is using styles.card. Using a plain string or quotes will not apply the module styles.
Fill both blanks to create a CSS module style object and apply it to a div in Astro.
import [1] from './Layout.module.css'; export default function Layout() { return <div className=[2].wrapper}}>Layout content</div>; }
Importing the CSS module as styles and using styles.wrapper applies the CSS module class correctly.
Fill all three blanks to create a CSS module, import it, and apply multiple classes in Astro.
/* Layout.module.css */
.wrapper {
display: flex;
}
.main {
flex: 1;
}
---
import [1] from './Layout.module.css';
export default function Layout() {
return (
<div className=[2].wrapper}>
<main className=[3].main}>Content</main>
</div>
);
}Importing the CSS module as css and using css.wrapper and css.main applies the styles correctly.