当前位置: 首页 > 网络学院 > 网页制作基础教程 > HTML > HTML <div>标签
The <div> tag defines a division/section in a document.
<div>标签可用来定义文档中的某个区或是某个章节
The "align" attribute of the div element was deprecated in HTML 4.01.
div元素中的"align"属性在HTML4.01中不被推荐
The "align" attribute of the div element is not supported in XHTML 1.0 Strict DTD.
在XHTML1.0严密型DTD将不支持div元素里的"align"属性。
Note: Browsers usually place a line break before and after the div element.
注意:浏览器通常会在div元素的后面与前面加上换行
Tip: Use the <div> tag to group block-elements to format them with styles.
提示:可以使用样式来将<div>标签所组成的块素群进行排版
代码 | 输出结果 |
---|---|
This is some text <div style="color:#FF0000;"> <h4>This is a header in a div section</h4> <p>This is a paragraph in a div section</p> </div> | This is some text This is a header in a div sectionThis is a paragraph in a div section |
DTD indicates in which DTD the attribute is allowed. S=Strict, T=Transitional, and F=Frameset.
下表中的DTD列指明了被支持的DTD属性。S=Strict(精确的),T=Transitional(传统的),F=Frameset(框架)
属性名 | Value | 描述 | DTD |
---|---|---|---|
align | left right center justify | How to align the text in the div element. Deprecated. Use styles instead. div元素里文字的对齐方向,不推荐,使用样式 | TF |
id, class, title, style, dir, lang, xml:lang |
For a full description, go to Standard Attributes.
查看完整的描述
onclick, ondblclick, onmousedown, onmouseup, onmouseover, onmousemove, onmouseout, onkeypress, onkeydown, onkeyup |
For a full description, go to Event Attributes.
查看完整的描述