Do I need to write <!DOCTYPE HTML>
at the top of every page? I don't do it at the moment and everything seems to work fine. What is the purpose of it, if we already have <html>
?
Asked
Active
Viewed 1,188 times
0

Benjamin Lewis
- 33
- 7
-
3Possible duplicate of [Why do I need a doctype? (What does it do)](http://stackoverflow.com/questions/6076432/why-do-i-need-a-doctype-what-does-it-do) – Justinas Jun 22 '16 at 06:18
-
2Possible duplicate of [What is the functionality of !DOCTYPE?](http://stackoverflow.com/questions/1818587/what-is-the-functionality-of-doctype) – Rando Hinn Jun 22 '16 at 06:20
3 Answers
3
It is an instruction to the web browser about what version of HTML the page is written in. The <!DOCTYPE html>
is standard for HTML 5. Hope this link help you HTML Declaration

Engkus Kusnadi
- 2,386
- 2
- 18
- 40
0
Yes, it is. Otherwise browser will default to Quirks Mode:
References:

Community
- 1
- 1

Sunny Sharma
- 4,688
- 5
- 35
- 73
-1
It isn't required as such, world won't end and neither will your code if you don't have it. However, it gives the browser information to what HTML version you are using and not having it can create some issues further on, especially if your sites get larger amounts of code and complexity, and thus is recommended to add to your code.

Xariez
- 759
- 7
- 24
-
@Dmitry Sorry for the delayed reply. Looking back at it i see how extremely vague my reply was, so thanks a lot for filling it in! – Xariez Jun 06 '18 at 13:20
-