Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

941
Views
How to change the default screen background color of all the pages in React JS(Next JS) using tailwind CSS

I am trying to change the default screen background colour of all the pages of the web application.

Technologies I used:

  1. React JS
  2. Next JS
  3. Tailwind CSS

I want to make the screen background colour of all pages light grey as shown in the image instead of the default white colour.

enter image description here

Is there any way to do that all at once, or do we need to add background colour manually to every page?

about 4 years ago · Juan Pablo Isaza
3 answers
Answer question

0

If you are using NextJS you can make use of a custom file _app.jsx (if you are using javascript) or _app.tsx (if you are using TypeScript) to change the background colour (and many more by the way) of all your web pages.

You can create a div in the file and add background colour to the className, it will be applied to all pages being rendered in the web application.

Code example :

function MyApp({ Component, pageProps }) {
 return (
  <div className="bg-gray-500">
    <Component {...pageProps}/>
  </div>
 );
}

NextJS has a more detailed explanation about this.

about 4 years ago · Juan Pablo Isaza Report

0

You can go to styles -> globals.css and there add the following

html {
  width: 100%;
  height: 100%;
  background-color: {color of your choice};
}

By this; all your pages will have the specified background color unless you specify a separate background color for any component.

about 4 years ago · Juan Pablo Isaza Report

0

Adding bg-color to a div only adds color to a div... I think the html { background-color: {color of your choice}; is more likely to yield the desired result. Having same issue. Applied your solution but it only filled the div that fell short of page view. Of course the previous comment's coding is incorrect. should be:

html {
    background-color: #yourcolor
}
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!