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

146
Vistas
How can I disable all CSS that can affect my widgets on another website?

I'm building JavaScript widgets that are supposed to be added onto other people's websites.

I style my widgets by dynamically adding a CSS to the pages they're on.

For example,

My CSS code below applies to a DIV inside my widget:

.myWidget { background-color: red; }

But a CSS file outside my own on a remote page might have:

div { border: 5px solid green; }

The CSS above would also apply to my widgets. How can I disable all other CSS outside my own?

Thanks

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

0

You could be Using shadow DOM

Shadow DOM MDN Web Docs

An important aspect of web components is encapsulation — being able to keep the markup structure, style, and behavior hidden and separate from other code on the page so that different parts do not clash, and the code can be kept nice and clean. The Shadow DOM API is a key part of this, providing a way to attach a hidden separated DOM to an element.

about 4 years ago · Juan Pablo Isaza Denunciar

0

You can use the all shorthand property and the unset keyword to set each property's value to its initial value.

.myWidget {
  all:unset;
  background-color: red;
}

div {
  background-color:yellow;
}
<div class="myWidget">Hello World!</div>

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