So i was trying out Next.js with typescript and tailwindcss. I did the initial commit and then started modifying the layout.tsx
file.
This is what I get after running the dev server
This is the content of layout.tsx
file:
import "./globals.css";
import type { Metadata } from "next";
import { Inter } from "next/font/google";
const inter = Inter({ subsets: ["latin"] });
export const metadata: Metadata = {
title: "Quiz app",
description: "A simple quiz app",
};
export default function RootLayout({
children,
}: {
children: React.ReactNode;
}) {
return (
<html lang="en">
<body
className={`${inter.className} bg-slate-700 container mx-auto p-4 text-slate-100`}
>
{children}
</body>
</html>
);
}
page.tsx
only has a div with h1 tag in it
Here is the tailwind.config.js
file content:
/** @type {import('tailwindcss').Config} */
module.exports = {
content: [
"./pages/**/*.{js,ts,jsx,tsx,mdx}",
"./components/**/*.{js,ts,jsx,tsx,mdx}",
"./app/**/*.{js,ts,jsx,tsx,mdx}",
],
theme: {},
plugins: [],
};
The expected render should’ve been a continuous background of slate-700 color.
Any help will be appreciated.
2
Answers
I got to know where the issue was. Thanks to @wongjn for pointing this out. It was the
globals.css
file that I haven't checked. It had the linear-gradient settings and stuff that was rendering the output like that.Go to
globals.css
and change the styles for body. So instead of the default gradient, something like this:And customize
--background-rgb
as you like.