简介

HTML <div> 元素 (或 HTML 文档分区元素) 是一个通用型的流内容容器,它在语义上不代表任何特定类型的内容,它可以被用来对其它元素进行分组,一般用于样式化相关的需求(使用 class 或 id 特性) 或者对具有相同特性的一组元素进行分组 (比如 lang),它应该在没有任何其它语义元素可用时才使用 (比如 <article> 或 <nav>) 。

 

 

特性

该元素包含所有 全局特性.

HTML5  中, <div> 的 align  特性已经 .

示例

<div>
  <p>这里可以是任何内容,比如 &lt;p&gt;, &lt;table&gt;,一切由你作主。</p>
</div> 

结果

这里可以是任何内容,比如 <p>, <table>,一切由你作主。

规范

规范 状态 备注
HTML Living Standard
<div>
Living Standard  
HTML5
<div>
Recommendation  
HTML 4.01 Specification
<div>
Recommendation  

浏览器兼容性

 

Update compatibility data on GitHub
DesktopMobile
ChromeEdgeFirefoxInternet ExplorerOperaSafariAndroid webviewChrome for AndroidFirefox for AndroidOpera for AndroidSafari on iOSSamsung Internet
divChrome Full support YesEdge Full support YesFirefox Full support 1IE Full support YesOpera Full support YesSafari Full support YesWebView Android Full support YesChrome Android Full support YesFirefox Android Full support 4Opera Android Full support YesSafari iOS Full support YesSamsung Internet Android Full support Yes
align
DeprecatedNon-standard
Chrome Full support YesEdge Full support YesFirefox Full support 1IE Full support YesOpera Full support YesSafari Full support YesWebView Android Full support YesChrome Android Full support YesFirefox Android Full support 4Opera Android Full support YesSafari iOS Full support YesSamsung Internet Android Full support Yes

Legend

Full support  
Full support
Non-standard. Expect poor cross-browser support.
Non-standard. Expect poor cross-browser support.
Deprecated. Not for use in new websites.
Deprecated. Not for use in new websites.

相关内容

文档标签和贡献者

此页面的贡献者: gafish, mdnwebdocs-bot, YunZhongZi, pantao, FredWe
最后编辑者: gafish,