您的位置:首页 > Web前端 > HTML

HTML document, documentElement , body 各对象.

2011-05-13 13:12 543 查看
document              // Html 的容器对象.

document.documentElement      //html 对象

document.body            // body 对象

$(document.documentElement).find("body") ;    // Body 对象.

各个高度有各个高度的含义.

document > document.documentElement > body .

但是 document.height 却很小.

试验:

<div style="margin: 1px 2px 3px 4px; padding: 5px 6px 7px 8px; border-top: 9px solid pink;
border-right: 10px solid pink; border-bottom: 11px solid pink; border-left: 12px solid pink;
background-color: green; height: 300px;">
<div style="height: 25px;background-color:Blue;">
</div>
<div class="FillHeight" style="margin: 13px 14px 15px 16px; padding: 17px 18px 19px 20px;
border-top: 21px solid pink; border-right: 22px solid pink; border-bottom: 23px solid pink;
border-left: 24px solid pink; background-color: Yellow;">
<asp:ContentPlaceHolder ID="MainContent" runat="server">
</asp:ContentPlaceHolder>
</div>
</div>

Height 就是 内容部分的高度.

outerHeight = Heigth + Border + Padding .

Offset 是按 outerHeight 的位置来计算的. 即= 边框左上角 的 Offset .

容器A

容器内要计算的对象B

B高 = A 高- B.Offset().top - B.marginBottom - B.Border - B.Padding
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: