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

262
Visualizações
Track where specific style property was set from?

We can get style property of an element via getComputedStyle() but is there a way detect/track where this value was set from: user's CSS or system default or neither?

In this example only bakckground-color is set by user's stylesheet, display is set by "user agent stylesheet" (aka browser default) and width is not set by anything, it's automatically generated:

console.log("backgroundColor", getComputedStyle(test).backgroundColor);
console.log("display", getComputedStyle(test).display);
console.log("width", getComputedStyle(test).width);
#test
{
  background-color: lightblue;
}
<div id="test">test</div>

p.s. in DevTools there is a link to the stylesheet where the property is set:

enter image description here

and it shows which stylesheet sets the value:

enter image description here

about 4 years ago · Juan Pablo Isaza
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