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

194
Visualizações
Element height won't change with getBoundingClientRect()

I'm trying to resize the height of an element by using Element.getBoundingClientRect(). The height of the element was logged before and after element_box.height += 50; where the computed height does change. Yet, the height of the element doesn't change on the page. Why does div height remain 120px when it's suppose to be 170px?

https://jsfiddle.net/sxm2gn48/1/

<div></div>
div {
  border: 1px solid;
  height: 120px;
  width: 130px;
}
let div = document.querySelector("div");

window.addEventListener("load", function(event) {
    const element_box = div.getBoundingClientRect();
    element_box.height += 50;
})
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