English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
Der HTML <div>-Tag definiert einen allgemeinen Container im HTML-Dokument, der normalerweise zur Gruppierung von Elementen verwendet wird. Dieser Tag wird auch als <div>-Element bezeichnet.
In dem Dokument wurden drei <div>-Tags erstellt:
!doctype html <html> <head> <meta charset="UTF-8"> <title>HTML5 div-Tagsverwendung (Grundtutorialsite oldtoolbag.com)</title> <style> .div_class{color:red} #div_id{color:blue} </style> </head> <body> <div> <h2>Erster Div</h2> <p>Dieser Text wird im Div-Teil des Dokuments angezeigt</p> </div> <div class="div_class"> <h2>Der zweite Div mit Klasse angewendet</h2> <p>Dieser Text wird im Div-Teil des Dokuments angezeigt</p> </div> <div id="div_id"> <h2>Der dritte Div mit id angewendet</h2> <p>Dieser Text wird im Div-Teil des Dokuments angezeigt</p> </div> </body> </html>Testen Sie, um zu sehen ‹/›
In diesem HTML5In der Dokumentbeispiel haben wir drei <div>-Tags erstellt. Der erste <div>-Tag hat keine Klasse oder ID angewendet. Der zweite <div>-Tag wendet eine Klasse namens div_class auf den <div>-Tag an. Der dritte <div>-Tag wendet eine ID namens div_id auf den <div>-Tag an.
IEFirefoxOperaChromeSafari
Alle gängigen Browser unterstützen den <div>-Tag.
The <div> tag is usually used to group elements together.
The <div> tag defines a section or an area within an HTML document.
The <div> tag is commonly used to group block-level elements so that they can be formatted using CSS.
Tip:<div> elements are often used with CSS to layout 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.
HTML5 The align attribute is not supported in HTML.
In HTML 4.01 In, the align attribute is discontinued.
Attribute | Value | Description |
---|---|---|
align | left right center justify | HTML5 Not Supported. HTML 4.01 Discontinued. Specify the alignment of the content within the <div> element. |
<div> Tag Supported Global Attributes of HTML.
<div> Tag Supported HTML Event Attributes.
HTML Tutorial:HTML Layout