开发者

When I use jquery count body's height,the absolute position element'height wouldn't be include?

开发者 https://www.devze.com 2023-02-01 05:00 出处:网络
Hello all,I\'m a junior on html,I have a question about css position : first here is my demo html code

Hello all,I'm a junior on html,I have a question about css position :

first here is my demo html code

<div id="test-header">开发者_开发技巧</div>
<div id="test-content"></div>
<input type="button" value="body">

I set the "test-content" position: absolute,the "test-header" in default

but when I use $("body").height() to get the body's height,it only alert the "test-header"'s height ……

So why count would not include the abasolute element's height?

How can I solve this problem ?

here is my online case


This is the correct result, when you absolutely position an element it's taken out of the flow of the document, and doesn't occupy any space inside it's parent...which is why <body> doesn't account for the size it takes up.

0

精彩评论

暂无评论...
验证码 换一张
取 消