<div>
HTML <div> Tag
Instance
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>php中文网(php.cn)</title> </head> <body> <p>这是一些文本。</p> <div style="color:#0000FF"> <h3>这是一个在 div 元素中的标题。</h3> <p>这是一个在 div 元素中的文本。</p> </div> <p>这是一些文本。</p> </body> </html>
Run Example»
Click the "Run Instance" button to view the online instance
Browser support
All major browsers support< div> tag.
Tag definition and usage instructions
<div> tag defines a separated block or a region in an HTML document. The
<div> tag is often used to group block-level elements so that they can be formatted with CSS.
Tips and Notes
Tips: The <div> element is often used with CSS to lay out web pages.
Note: By default, browsers usually place a line break before and after the <div> element. However, you can change this by using CSS.
Differences between HTML 4.01 and HTML5
The align attribute is not supported in HTML5.
In HTML 4.01, the align attribute is deprecated.
Properties
Properties | Value | Description |
---|---|---|
align | left right center Justify | HTML5 is not supported. HTML 4.01 is deprecated. Specifies the alignment of content within a <div> element. |
Global attributes
The<div> tag supports global attributes of HTML.
Event attributes
<div> tag supports HTML event attributes.
Related Articles
HTML Tutorial: HTML Layout