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

93
Views
How i can apply a background image to the body of only ONE Component React

I have a main component on every page, which is Navbar, and I have another component, which is a page to contact us. I want to make a background for a component that contact us, but it does not affect the Navbar? Also, if I give body tag the background image, all the other components will take the same background as the photo cuz i give it to the body! what i can do in this case?

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

0

You have to wrap each component in a different div.

<div>
 Navbar
</div>

<div style={{backgroundColor: 'color here'}}>
 Contact us
</div>

Style inside the div or add a className and style in a separate file with CSS:

<div className="yourClass">
 Contact us
</>

and in a separate .css file:

.yourClass {
 background-color: 'color name';
}
about 4 years ago · Juan Pablo Isaza Report

0

Simple HTML question, just apply the class to only one of your elements, and don't have them nested.

<containing-element>
  <navbar />
  <contact-page className="contact" />
</containing-element>

You can then style .contact

.contact {
  background-color: #FF0000;
}
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!