Next.js Discord

Discord Forum

Module.css

Answered
Shine posted this in #help-forum
Open in Discord
Hey there, i have a quick question, is this a good way to use module.css like a normal css file ? I mean, i import my css file like that :

import styles from '/day/module.css

But in my file, i have classes like .content :

.content {
    display: flex;
    align-items: center;
    flex-direction: column;
}

and i wanted to know if i have to put a className on my <h1> or i can do :

.content h1 {
  color: red;
Answered by American Chinchilla
@Shine .module.css can be treated as normal css. And as someone said above the extension is .module.css.


https://nextjs.org/docs/app/building-your-application/styling/css-modules#css-modules
View full answer

3 Replies

You can directly use .content itself

Also you need to name the file something like day.module.css

I dont use module css much so im not sure but im pretty sure you need to use "module.css" as the extension
American Chinchilla
@Shine .module.css can be treated as normal css. And as someone said above the extension is .module.css.


https://nextjs.org/docs/app/building-your-application/styling/css-modules#css-modules
Answer
@American Chinchilla <@469208754047418378> .module.css can be treated as normal css. And as someone said above the extension is .module.css. https://nextjs.org/docs/app/building-your-application/styling/css-modules#css-modules
Yes, i know it's something.module.css, just missclicked while typing the code.

And okay, just wanted to know if i could directly call component <button> without problem so thx mate