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

232
Vistas
Override background-color using `!important`

How do I override class background color? Tried !important but not working, the text is still yellow.

<!DOCTYPE html>
<html>
<head>
<style>
.myclass {
  background-color: yellow ;
}
</style>
</head>
<body>

<p class="myclass" background-color="red !important">This is some text in a paragraph.</p>

</body>
</html>

about 4 years ago · Juan Pablo Isaza
3 Respuestas
Responde la pregunta

0

if you want use inline styles (not good), you should use style attribute on html elements and in any way of using css you should use colon : instead of = for giving value to properties, try this snippet:

<!DOCTYPE html>
<html>

<head>
  <style>
    .myclass {
      background-color: yellow;
    }
  </style>
</head>

<body>

  <p class="myclass" style="background-color:red !important;">This is some text in a paragraph.</p>

</body>

</html>

about 4 years ago · Juan Pablo Isaza Denunciar

0

You need to put inline css in the style attribute like so:

<!DOCTYPE html>
<html>
<head>
<style>
.myclass {
  background-color: yellow ;
}
</style>
</head>
<body>

<p class="myclass" style="background-color: red !important;">This is some text in a paragraph.</p>

</body>
</html>

about 4 years ago · Juan Pablo Isaza Denunciar

0

You need to mention style.

<p class="myclass" style="background-color:red !important;">This is some text in a paragraph.</p>
about 4 years ago · Juan Pablo Isaza 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