Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

244
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar

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 Denunciar

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda