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

254
Visualizações
how to write hover in same class in css file for react js

enter image description here enter image description here

This is a reactjs project, Te amperzand syntax is working fine in Javascript file but not in css.

How to write hover class in css file?

about 4 years ago · Santiago Gelvez
2 Respostas
Responde à pergunta

0

You must write it this way

.baseStyle {
 /* base styles goes here*/

}

.baseStyle:hover {
/* hover styles goes here */
}

If you wish to attain what you intend you must use scss.

Then it will be like

.class {
    margin:20px;
    &:hover {
        color:yellow;
    }
}

Reference

  1. Using Scss in React
about 4 years ago · Santiago Gelvez Relatório

0

If you want to write in same class. You should use Sass/Scss.

Save the css file with .scss extension. It is a precprocessor for better syntax.

Refer this sandbox:

https://stackblitz.com/edit/react-uwktzj?file=src%2FApp.js

about 4 years ago · Santiago Gelvez 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