body中html代码,body HTML元素

定义

指明文档主体的开始和结束。

Specifies the beginning and end of the document body.

注释

在 Internet Explorer 6 中,如果你使用 !DOCTYPE 声明指定为标准兼容模式,body 对象可以从其内容获取其大小,或者你可以像 div 对象那样严格设置其大小。在标准兼容模式下,html 元素会代表文档可显示内容的整个外观。如果 !DOCTYPE 声明并不指定标准兼容模式,以及较早版本的 Internet Explorer,则是 body 对象代表文档可显示内容的整个外观。body 对象的大小无法更改,它等于窗口的大小。你在此对象上设置的边距位于此对象的边框和滚动条之内。

你可以在脚本中通过 document 对象来访问 body 元素。

元素 body 的 window 对象可以处理 onblur, onfocus, onload, 或 onunload 事件。

此元素在 Internet Explorer 3.0 及以上版本的 HTML 中可用,在 Internet Explorer 4.0 及以上版本的脚本中可用。

此元素是块元素。

此元素需要关闭标签。

As of Internet Explorer 6, when you use the !DOCTYPE declaration to specify standards-compliant mode, the body object can obtain its size from its content, or you can set its size explicitly—like a div object, for example. In standards-compliant mode, the html element represents the entire surface onto which a document‘s contents can be rendered. When the !DOCTYPE declaration does not specify standards-compliant mode, and with earler versions of Internet Explorer, the body object represents the entire surface onto which a document‘s contents can be rendered. The size of the body object cannot be changed and is equal to the size of the window. Margins you set on this object are rendered inside the border and scrollbars of the object.

You can access the body element from script through the document object.

The window object for the body element can host event handlers for the onblur, onfocus, onload, or onunload events.

This element is available in HTML as of Internet Explorer 3.0, and in script as of Internet Explorer 4.0.

This element is a block element.

This element requires a closing tag.

示例代码

下面的例子在脚本中引用了 body 元素。

This example exposes the body element in script.var oBody = document.body;

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值