Next.js Discord

Discord Forum

CSS not working

Unanswered
Bahama Swallow posted this in #help-forum
Open in Discord
Avatar
Bahama SwallowOP
I styled my page using CSS, but it doesn't load inside my routes and components
Image

32 Replies

Avatar
Masai Lion
you have already ./global.css
Image
@Bahama Swallow
Avatar
if you arent using tailwind, you need to actually add your classes to the html. it wont just “pick it up”
Avatar
Bahama SwallowOP
yes
Avatar
Masai Lion
I think you can not import all css two time
Avatar
Bahama SwallowOP
serious ? how do i do that, it's the same as the documentation, do i have to import the css in every page and style it?
Avatar
Masai Lion
do
import styles from "@/styles/your-css.css"
like this you can do
 className={styles.theName}
Avatar
Bahama SwallowOP
ok, i try it now, thanks @Masai Lion
Avatar
Masai Lion
your welcome
ask if you can't make it
Avatar
Bahama SwallowOP
ok
Is that because I'm not styling the routes or is there something wrong?
Image
so there is no error import '@/styles/global.css'
but i cant' use classname={styles.theName}
Avatar
Masai Lion
ok so
globla.css you do not touch it
its de css of all your pages
if you want to create a css only for one page
i recomend you to create a folder named styles and to pout all your css in there
and you import it like you did but with the name of the css
Image
Image
like this
Avatar
Bahama SwallowOP
so i created a css and i have to import in every page? I tried to create a css file for each page and import it as styles, but it gave an error, even though I followed Next's documentation
Avatar
Masai Lion
do you wanna voc ? hhaha
Avatar
Bahama SwallowOP
i don't understand what is voc, sorry hahahahha
Avatar
Masai Lion
vocal chat haha
Avatar
Bahama SwallowOP
ok, may be tomorrow ?
Avatar
Masai Lion
okay
Avatar
Bahama SwallowOP
deal bro