Next.js Discord

Discord Forum

Not Centering The Elements

Answered
rkstlohchab posted this in #help-forum
Open in Discord
@Anay-208 it is not working
Answered by Anay-208
in layout.tsx, you aren't importing globals.css
View full answer

38 Replies

@rkstlohchab <@755810867878297610> it is not working
add class w-screen h-screen to the div
not working
Can you send contents of file globals.css?
sure thing
&913086567042674719 base;
&913086567042674719 components;
&913086567042674719 utilities;
i have only these
i am using tailwind with shadcn UI
and can you just send a screenshot of file tailwind.config.ts?
yup one sec
i think i disabled the css variable while initialising will it create problem?
Can you try restarting your next.js app?
i tried
i also tried
removing cache
and rebuilding
The exact issue is that Tailwind Css is not loading
can you share your package.json dependencies?
{
"name": "e-commerce",
"version": "0.1.0",
"private": true,
"scripts": {
"dev": "next dev",
"build": "next build",
"start": "next start",
"lint": "next lint"
},
"dependencies": {
"@hookform/resolvers": "^3.6.0",
"@radix-ui/react-label": "^2.0.2",
"@radix-ui/react-slot": "^1.0.2",
"class-variance-authority": "^0.7.0",
"clsx": "^2.1.1",
"lucide-react": "^0.395.0",
"mongoose": "^8.4.1",
"next": "14.2.4",
"next-cloudinary": "^6.6.2",
"react": "^18",
"react-dom": "^18",
"react-hook-form": "^7.52.0",
"tailwind-merge": "^2.3.0",
"tailwindcss-animate": "^1.0.7",
"zod": "^3.23.8"
},
"devDependencies": {
"@types/node": "^20",
"@types/react": "^18",
"@types/react-dom": "^18",
"eslint": "^8",
"eslint-config-next": "14.2.4",
"postcss": "^8",
"tailwindcss": "^3.4.1",
"typescript": "^5"
}
}
can you share your layout.tsx of the page which you are visiting?
wait, your layout.tsx needs to be inside app folder
and its inside collections folder @rkstlohchab
move your layout.tsx in apps folder, and if you still get the error, send the code of that file
@Anay-208 wait, your layout.tsx needs to be inside app folder
it is inside the app folder
but in organisational folder
it shouldnt be the matter
in layout.tsx, you aren't importing globals.css
Answer
yupp
add this at the top
import "@/app/globals.css"
got it bro
thank you so much
@Anay-208 in `layout.tsx`, you aren't importing globals.css
Mark this message as a solution
by right clicking, mark solution
where exactly?
i am not able to find
Nevermind, if you can't find it, I'll tell a helper to do that!