Doctype html bedeutung

Erklärung ist nicht ein HTML-Tag, es verwendet wird, um die Web-Browser-Seite zu sagen, welche die HTML-Version verwendet.

In HTML 4.01 Deklaration erforderlichen Referenz DTD (Document Type Declaration), da HTML 4.01 basiert auf SGML (Standard Generalized Markup Language Standard Generalized Markup Language). DTD legt die Regeln für die Auszeichnungssprache, um sicherzustellen, dass der Browser richtig Inhalt machen kann.

HTML5 basiert nicht auf SGML und daher keinen Referenz DTD erfordert.

Tipp: Immer das HTML - Dokument geben eine Erklärung ab, um sicherzustellen , hinzuzufügen , dass der Browser den Dokumenttyp kennen , können .


Die Unterschiede zwischen den HTML 4.01 und HTML5

HTML 4.01 gibt drei verschiedene Aussagen, nämlich : Strict, Transitional und Frameset. HTML5 gibt nur eines der folgenden:



HTML-Elemente und Doctypes

Siehe HTML - Elemente und legitime Doctype , schauen sich an HTML - Element , das in der Doctype erscheint.


Tipps und Hinweise

HINWEIS: -Tag hat kein Ende - Tag.

Tipp: Erklärung wird nicht zwischen Groß- und Kleinschreibung.

Tipp: Verwenden Sie die W3C überprüfen zu überprüfen , ob Sie HTML mit einem legitimen Recht der DTD / XHTML - Dokument schreiben!


Gemeinsame DOCTYPE-Deklaration

HTML 5

HTML 4.01 Strict

Diese DTD enthält alle HTML-Elemente und Attribute, aber keine Repräsentation oder veraltete Elemente (wie Schriftart) umfassen. Rahmenset ist nicht erlaubt.

HTML 4.01 Transitional

Diese DTD enthält alle HTML-Elemente und Attribute, einschließlich Aussehen oder veraltete Elemente (wie Schrift). Rahmenset ist nicht erlaubt.

HTML 4.01 Frameset

Die DTD HTML 4.01 Transitional und das gleiche, aber erlaubt die Verwendung von Frameset-Inhalt.

XHTML 1.0 Strict

Diese DTD enthält alle HTML-Elemente und Attribute, aber keine Repräsentation oder veraltete Elemente (wie Schriftart) umfassen. Rahmenset ist nicht erlaubt. Struktur muss nach dem XML-Standard-Format geschrieben werden.

XHTML 1.0 Transitional

Diese DTD enthält alle HTML-Elemente und Attribute, einschließlich Aussehen oder veraltete Elemente (wie Schrift). Rahmenset ist nicht erlaubt. Struktur muss nach dem XML-Standard-Format geschrieben werden.

XHTML 1.0 Frameset

Die DTD XHTML 1.0 und das gleiche, aber erlaubt die Verwendung von Frameset-Inhalt.

XHTML 1.1

Die DTD XHTML mit dem gleichen 1.0 Strict, sondern ermöglicht es Ihnen, ein Modul hinzufügen (zum Beispiel Ruby-Unterstützung für ostasiatische Sprachen zur Verfügung zu stellen).

The HTML document type declaration, also known as DOCTYPE, is the first line of code required in every HTML or XHTML document. The DOCTYPE declaration is an instruction to the web browser about what version of HTML the page is written in. This ensures that the web page is parsed the same way by different web browsers.

In HTML 4.01, the DOCTYPE declaration refers to a document type definition (DTD). A DTD defines the structure and the legal elements of an XML document. Because HTML 4.01 was based on the Standard Generalised Markup Language (SGML), referring to a DTD in the DOCTYPE declaration was necessary.

Additionally, doctypes for HTML 4.01 required the declaration of either strict, transitional, or

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
0 DTD, each with a different use case as outlined below.

  • Strict DTD: Used for web pages that exclude attributes and elements that W3C expects to phase out as CSS support grows
  • Transitional DTD: Used for web pages that include attributes and elements that W3C expects to phase out as CSS support grows
  • Frameset DTD: Used for web pages with frames

In contrast, the declaration of HTML5 DOCTYPE is much simpler: it no longer requires a reference to DTDs as it is no longer based on SGML. See the examples below for a comparison between HTML 4.01 and HTML5 DOCTYPEs.

Examples

Doctype syntax for HTML5 and beyond:

<!DOCTYPE html>

Doctype syntax for strict HTML 4.01:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">

Doctype syntax for transitional HTML 4.01:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

Doctype syntax for frameset HTML 4.01:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN" "http://www.w3.org/TR/html4/frameset.dtd">

History

During the formative years of HTML, web standards were not agreed upon yet. Browser vendors would build new features in whatever way they wanted. There was little concern for competing browsers.

The result was that web developers had to choose a browser to develop their sites for. This meant that sites would not render well in unsupported browsers. This situation could not continue.

The W3C (World Wide Web Consortium) wrote a set of web standards to handle this situation. All browser vendors and web developers should adhere to these standards. This would ensure that websites would render well across browsers.

The changes required by the standards were quite different from some existing practices. Adhering to them would break existing non standards compliant websites.

To handle this problem, vendors began programming rendering modes in to their browsers. Web developers would need to add a doctype declaration to the top of an HTML document. The doctype declaration would tell the browser which rendering mode to use for that document.

Three separate rendering modes were generally available across browsers.

  • Full standards mode renders pages according to the W3C web standards.
  • Quirks mode renders pages in a non standards compliant way.
  • Almost standards mode is close to full standards mode, but features support for a small number of quirks.

In the modern age of HTML5, web standards are fully implemented in all major browsers. Web sites are generally developed in a standards compliant way. Because of this the HTML5 doctype declaration only exists to tell the browser to render the document in full standards mode.

Usage

The Doctype Declaration must be the very first line of code in an HTML document, aside from comments, which can go before it if needed. For modern HTML5 documents the doctype declaration should be as follows:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
3

More Information:

While no longer in general use, there are several other doctype declaration types from previous versions of HTML. There are also specific versions for XML documents. To read more about these, and to see code examples for each, take a look at the Wikipedia article.

A note from the W3

MDN Glossary entry

W3Schools

A quick explanation of “Quirks Mode” and “Standards Mode”

ADVERTISEMENT

ADVERTISEMENT

ADVERTISEMENT


If this article was helpful, tweet it.

Learn to code for free. freeCodeCamp's open source curriculum has helped more than 40,000 people get jobs as developers. Get started

Für was steht doctype HTML?

DOCTYPE ist kein HTML-Element Die HTML-Standards brachten im Laufe der Jahre Versionen hervor, die dem heutigen Wunsch nach einer sauberen Struktur entgegenlaufen. Ohne ! DOCTYPE könnte der Browser eine Webseite trotz validem HTML fehlerhaft darstellen, weil er sich an seine alte Darstellung eines Elements hält.

Warum sollte jedes HTML Dokument eine Doctype Deklaration haben?

Vor HTML5 bedingte eine standardkonforme Webseite mit HTML die Angabe einer Dokumententypdefinition (DTD) mit einer Dokumententyp-Deklaration. Mit einer Dokumententyp-Deklaration konnte sichergestellt werden, dass eine Webseite von Browsern und anderer Software gleichartig verarbeitet und angezeigt wird.

Was versteht man unter HTML?

Was ist HTML? Per Definition versteht man unter HTML eine einheitliche, textbasierte Auszeichnungssprache. Sie besteht aus einfachen Auszeichnungselementen, den sogenannten „Tags“ als auch inhaltsleeren Elementen wie etwa <br>. HTML steht als Abkürzung für „Hypertext Markup Language“.