Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

95
Visualizações
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 Respostas
Responde à pergunta

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 Relatório

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda