When using HTML editor in creating HTML document, you might not notice it but there’s a special line at the top of your source code prior to the opening tag. This is referred to as DocType or Document Type Definition. Its job is to tell the browser the type of HTML version you’re using.
The fact is, not all HTML is created equally as there are various versions of it.
What’s the Use?
Much like HTML specification evolved from the past 20 years, so did the browsers. Back on the early days of the internet, it often overlooks the official standards. Luckily, over the last ten years, browsers made a shift and started to become mindful of standards in web design and comply with it.
These standards are basically standards prepared by the World Wide Web Consortium or simply known as the W3C.
Never Disregard it. Ever
DocType is telling your browser whether it has to render the page in Standards-Compliant mode or Quirks mode. Now, you could see why it is important to specify the document type for your websites. Otherwise, the web browser would go retro when rendering professionally designed websites. At the end, no matter how beautiful your web design is, it’ll be filled with bugs and display issues of a 15 year old browser. That’s something you probably don’t want to happen.