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

243
Visualizações
styles applied to Horizontal Line via css file is not working

https://codesandbox.io/s/goofy-pasteur-ntcuj

import "./styles.css";

export default function App() {
  const separator = {
    backgroundColor: "#E9E9E9",
    height: "12px",
    margin: "8px",
    borderRadius: "4px"
  };

  return (
    <div className="App">
      <hr style={separator} />
      <hr className="line-separator" />
    </div>
  );
}
.line-separator {
  background-color: #e9e9e9;
  height: 2px;
  margin: 8px;
  border-radius: 4px;
}

styles applied via java script is working fine but the same is not working from css for <hr /> tag.

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

0

Your className is wrong. try: <hr className="line-separator" />

You have another Typo in your CSS, your height should be 12px not 2px

about 4 years ago · Santiago Gelvez Relatório

0

you have a typo in setting className of the second hr as "separator". It should match the className specified in the css file.

Correct code:

import "./styles.css";

export default function App() {
  const separator = {
    backgroundColor: "#E9E9E9",
    height: "12px",
    margin: "8px",
    borderRadius: "4px"
  };

  return (
    <div className="App">
      <hr style={separator} />
      <hr className="line-separator" />
    </div>
  );
}
.line-separator {
  background-color: #e9e9e9;
  height: 2px;
  margin: 8px;
  border-radius: 4px;
}
about 4 years ago · Santiago Gelvez Relatório

0

this should be a super quick fix:

Your className needs to match the name of the css class .line-separator

import "./styles.css";

export default function App() {
  const separator = {
    backgroundColor: "#E9E9E9",
    height: "12px",
    margin: "8px",
    borderRadius: "4px"
  };

  return (
    <div className="App">
      <hr style={separator} />
      <hr className="line-separator" />
    </div>
  );
}

The height value here just needs changing to 12px

.line-separator {
  background-color: #e9e9e9;
  height: 12px;
  margin: 8px;
  border-radius: 4px;
}
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