Complete the code to apply a CSS class to a Next.js component.
export default function Button() {
return <button className=[1]>Click me</button>;
}class instead of className.In JSX, class names must be passed as strings inside curly braces. So className="btn-primary" is correct.
Complete the code to import a CSS module in Next.js.
import styles from '[1]'; export default function Header() { return <h1 className={styles.title}>Welcome</h1>; }
.module part..scss without setup.Next.js uses CSS modules with the .module.css extension for scoped styles.
Fix the error in the styled JSX block to apply red text color.
export default function Alert() {
return (
<>
<p>Warning!</p>
<style jsx>[1]
p { color: red; }
</style>
</>
);
}Styled JSX requires a template literal wrapped in backticks ` for CSS.
Fill both blanks to create a responsive container with Tailwind CSS in Next.js.
<div className="[1] [2]"> Content here </div>
Using container centers content with max width, and mx-auto centers horizontally.
Fill all three blanks to create a Next.js component using CSS modules with a button that has padding and blue background.
import styles from '[1]'; export default function BlueButton() { return <button className="[2] [3]">Click me</button>; }
Import the CSS module file, then use the module's padding and background color classes on the button.