I'm new learning HTML and now I have some code like
<div id="container" style="height:300px;width:500px;font-size:0">
<div id="leftBox" style="display: inline-block; background: pink; width: 50%; height: 100%;">
<div id="wrapper" style="height:10%;">
<div style="display: inline-block; background: red; width: 50%; height: 100%;"></div>
<div style="display: inline-block; background: blue; width: 50%; height: 100%;"></div>
</div>
</div>
<div id="rightBox" style="display: inline-block; background: green; width: 50%; height: 100%;"></div>
</div>
(And I posted it on http://jsfiddle.net/Simon_Chan/Z3WyA/ )
You can see the leftBox
has a big offsetTop, but if there is no wrapper
or wrapper
's height is 100% or there is no rightBox
or there is no elements in wrapper
, in all these conditions leftBox
has no offsetTop.
Why do it? And how to remove it?
Thanks!