English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

HTML Referenzhandbuch

Vollständiges Verzeichnis der HTML-Tags

HTML: <div> Tag

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.

Online-Beispiel

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.

Browserkompatibilität

IEFirefoxOperaChromeSafari

Alle gängigen Browser unterstützen den <div>-Tag.

Tag Description and Usage Instructions

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.

Tips and Notes

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.

HTML 4.01 and HTML5Differences between

HTML5 The align attribute is not supported in HTML.

In HTML 4.01 In, the align attribute is discontinued.

Attribute

AttributeValueDescription
alignleft
right
center
justify
HTML5 Not Supported. HTML 4.01 Discontinued.    Specify the alignment of the content within the <div> element.

Global Attributes

<div> Tag Supported Global Attributes of HTML.

Event Attributes

<div> Tag Supported HTML Event Attributes.

Related Articles

HTML Tutorial:HTML Layout