Recall & Review
beginner
What is Global CSS in Next.js?
Global CSS in Next.js means styles that apply to the whole app, not just one component. These styles affect every page and component unless overridden.
Click to reveal answer
beginner
Where should you import Global CSS files in a Next.js project?You should import Global CSS files only in the <code>pages/_app.js</code> or <code>app/layout.tsx</code> file. This ensures styles load once and apply globally.Click to reveal answer
intermediate
Why can't you import Global CSS files inside individual components in Next.js?Next.js restricts importing Global CSS in components to avoid style conflicts and ensure predictable styling. Global CSS must be imported once at the app root.
Click to reveal answer
beginner
How do you add a global CSS file in a Next.js 14 app using the App Router?
Place your CSS file in the <code>app</code> folder or <code>styles</code> folder, then import it in <code>app/layout.tsx</code> using <code>import './globals.css'</code>. This applies styles globally.Click to reveal answer
intermediate
What is the difference between Global CSS and CSS Modules in Next.js?
Global CSS applies styles everywhere in the app. CSS Modules scope styles to a single component, avoiding conflicts by generating unique class names.Click to reveal answer
Where should you import a global CSS file in a Next.js project?
✗ Incorrect
Global CSS files must be imported only in
pages/_app.js or app/layout.tsx to apply styles globally and avoid conflicts.What happens if you import a global CSS file inside a component in Next.js?
✗ Incorrect
Next.js does not allow importing global CSS inside components and will throw an error to prevent unpredictable styling.
Which file is the best place to import global CSS in Next.js 14 using the App Router?
✗ Incorrect
In Next.js 14 with the App Router,
app/layout.tsx is the root layout file where global CSS should be imported.What is a key benefit of using Global CSS in Next.js?
✗ Incorrect
Global CSS applies styles across the entire app, so you only import once and styles are available everywhere.
How does Global CSS differ from CSS Modules in Next.js?
✗ Incorrect
Global CSS affects the whole app, while CSS Modules create unique class names to limit styles to one component.
Explain how to properly add and use Global CSS in a Next.js project.
Think about where the app starts and how styles should be loaded once.
You got /4 concepts.
Describe the difference between Global CSS and CSS Modules in Next.js and when to use each.
Consider how styles affect multiple parts of the app versus just one part.
You got /5 concepts.