samedi 30 novembre 2019

i can not get the element height in javascript

here is my html code HTML

<div class="section s1">
    <div class="background" id="bgimage">
       .......
    </div>
</div>

CSS

.background {
    width: 100%;
    height: 500vh;
}

JavaScript

var background = document.getElementById('bgimage');
console.log(background.style.height);

but it brings nothing. i can not get the height of my element. it just brings an empty space in console of my browser




Aucun commentaire:

Enregistrer un commentaire