I am using nextjs 14 , and i want to know that how to include ‘style.css’ and other custom css files in nextjs project ?
My current file structure is
my-project/
├── components/
│ ├── footer.tsx
│ ├── header.tsx
│ └── page.tsx
├── pages/
│ ├── _app.tsx
│ └── index.tsx
├── styles/
│ ├── globals.css
│ └── styles.css
├── public/
│ └── image1.jpg
├── package.json
├── next.config.js
└── tsconfig.json
2
Answers
The import syntax would be as usual.
You can simply import using CSS file path.
import 'path/to/styles.css';
there is no need to add one CSS file to another CSS file like we import components in React.js.
You can add as many CSS files separately and they will work as expected.
Open your
_app.tsx
file in thepages
directory. add this CSS files like this