HTML !DOCTYPE Tag Declaration
Tags: learnhtml
Published: 2021-02-08 10:31:44

---
title: HTML !DOCTYPE Tag Declaration
published: true
date: 2021-02-08 10:16:41 UTC
tags: LearnHTML
canonical_url: https://sharepointanchor.com/learn-html/html-doctype-tag-declaration/
---

In [HTML](https://sharepointanchor.com/category/learn-html/), the **<!DOCTYPE>** tag is used to tell the browser which version of the HTML document is using. All **<abbr title="Hyper Text Markup Language">HTML</abbr>** documents should start with this **<!DOCTYPE>** declaration. It is the first line of the code in **HTML** or <abbr title="Extensible HyperText Markup Language"><strong>XHTML</strong></abbr> document.

**DOCTYPE** means **Document Type Declaration** **([DTD](https://en.wikipedia.org/wiki/Document_type_declaration))**. The **<!DOCTYPE>** tag is declared before the **<html>** tag. This tag does not have an end tag. In an HTML page, <abbr title="Document Type Declaration"><strong>DTD</strong></abbr> declaration can come once only.

<svg aria-hidden="true" focusable="false" data-icon="clock" width="20" height="20" fill="none" stroke="currentColor" style="display:inline-block;vertical-align:-0.1em" role="img" xmlns="http://www.w3.org/2000/svg" viewbox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 8v4l3 3m6-3a9 9 0 11-18 0 9 9 0 0118 0z"></path></svg>Estimated reading time: 3 minutes

## Syntax:

The Doctype is not an Element or tag, it just an instruction to the web browser about the version of the markup language in which a web page is written.

The DOCTYPE for **HTML 5** is very short and **not case-sensitive**.

```

<!DOCTYPE html>

```

But, the **<abbr title="Document Type Declaration">DTD</abbr>** for earlier versions of HTML were longer. The syntax of this DOCTYPE is given below:

```

[Root element] [Publicity] "[Registration]//[Organization]//[Type] [Name]//[Language]" "[URL]">

```

## <!DOCTYPE> Parameters:

- Here is the list of parameters in HTML <!DOCTYPE> declaration.
  - **Root Element** – It is the parent element of the document. For example, if the given document is an HTML file means, it uses the <html> tag
  - **Publicity** – This indicates whether the document is **PUBLIC** or **SYSTEM** (Ex: local files). For **HTML/XHTML** the value is **PUBLIC**
  - **Registration** – This contains two values that specify whether the developer is registered in **<abbr title="International Organization for Standardization">ISO</abbr>** or not.
    - **Plus (+)** – The developer **registered** in ISO
    - **Minus (-)** – The developer is **not registered** in ISO
  - **Organization** – It represents the **“Owner ID”** or name of the DTD developer.
  - **Type** – It represents the type of the document.
  - **Name** – This specifies the unique identifier describing DTD.
  - **Language** – It consists of a language name in short-form (Two letters in uppercase). For Example, the document is written in **English** means it specifies **‘EN’**.
  - **URL** – It represents the URL of the document.

## Types of <!DOCTYPE>Declaration for HTML:

There are three types of the **DTD** available for HTML. Let’s see them below:

- **Strict** : In HTML 4.01, it uses the Strict document type declaration. It contains all HTML elements and attributes. However, the presentational or deprecated **elements are not included**.

```

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

```

- **Transitional**  – It contains all HTML elements and attributes, including presentational and deprecated elements. **Frames are not allowed**.

```

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

```

- **Frameset** – It is similar to Transitional, but **frames can be allowed** in this DTD.

```

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

```

## Sample of HTML <!DOCTYPE> Declaration:

```

<!DOCTYPE html>
<html>
  <head>
    <title>Document Title</title>
  </head>
  <body>
    <h2>This is the heading</h2>
    <p>This is a sample paragraph.</p>
   </body>
</html>

```

## Result:

![](https://eadn-wc04-3430828.nxedge.io/cdn/wp-content/uploads/2021/02/Result-1.png)<figcaption>Result</figcaption>

## Browser Support:

![](https://eadn-wc04-3430828.nxedge.io/cdn/wp-content/uploads/2021/02/Browser-Support-2.png)<figcaption>Browser Support</figcaption>

## Frequently Asked Question:

**What is !DOCTYPE Tag in HTML ?** 

This tag instructs the browser about the version of HTML is being used in the web document.

 
 
**Can we declare the Language of Web Document inside this Tag ?** 

Yes, you can. You need to use the Language attribute along with this **!Doctype** Tag.

 
 
**Does Google Chrome supports !Doctype Tag ?** 

By default, Google Chrome and all other latest browser support the !Doctype tag.

 
 

The post [HTML <code><!DOCTYPE></code> Tag Declaration](https://sharepointanchor.com/learn-html/html-doctype-tag-declaration/) appeared first on [Share Point Anchor](https://sharepointanchor.com).