
- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Why do we use DOCTYPES in HTML document?
The HTML <doctype> tag is used for specifying which version of HTML the document is using. This is referred to as the document type declaration (DTD).
The <!DOCTYPE> declaration is the first thing you can see in the HTML document. It gets added before the <html> tag. The <!DOCTYPE> tag does not have an end tag!.
Declaration
HTML 4.01 had 3 possible doctypes − HTML 4 Strict, HTML 4 Transitional, and HTML 4 Frameset. Every HTML document you create should have one of these three DTDs.
HTML 4 Strict
This document type includes all HTML elements except those that have been deprecated and those that appear in frameset documents.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
HTML 4 Transitional
This document type includes all HTML elements including those that have been deprecated.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">;
HTML 4 Frameset
This document type includes all HTML elements in the transitional DTD as well as those in a framed document.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN" "http://www.w3.org/TR/html4/frameset.dtd">
HTML 5 Declaration
In HTML5 there is only one declaration i.e.
<!DOCTYPE html>
- Related Questions & Answers
- HTML Doctypes
- Why do we use head tag in HTML Page?
- Why do we use reset button in HTML forms?
- Why do we use the novalidate attribute in HTML?
- How do we add document title in HTML?
- Why do we use interfaces in Java?
- Why do we use random.seed() in Python?
- Why do we use pandas in python?
- Why do we use jQuery over JavaScript?
- Why do we use JSON.stringify() method in jQuery?
- Why do we use modifiers in C/C++?
- Why do we use restrict qualifier in C++?
- Why do we use const qualifier in C++?
- Why do we use comma operator in C#?
- Why do we use internal keyword in C#?