0

So my content div is basically hidden behind the header and footer, and has 100% height. On some pages I want to have a JS script to tell the content div move below the header and I tried it like so but it's not working:

document.getElementById('content').style.marginTop = document.getElementById('header').height + 55;
}

Any ideas?

4

1 回答 1

2
var height = document.getElementById('header').offsetHeight;
document.getElementById('content').style.marginTop = height + "px";
于 2012-10-12T09:18:28.090 回答