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

156
Visualizações
How to retrieve rendered padding value

I have a element with padding-right: 0.25em; and font-size: 2.75em;, this element is inside its parent node. the parent node has this style : font-size: 20px.

So the actual padding of the element is controlled by font size of the parent node right?

I may change my parent node font size to have different padding right value, How can I dynamically retrieve the real rendered value of the new padding-right?

I tried :

$('.word').innerWidth() - $('.word').width()

But this bring only the fixed value!!! in my case 12..

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

Use getComputedStyle as following:

let para = document.querySelector('.word');
let compStyles = window.getComputedStyle(para);

let mypadding = compStyles.getPropertyValue('padding-right');
about 4 years ago · Juan Pablo Isaza 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