Last updated on

Why do I need to declare a doctype?

The doctype tells browsers what kind of content the web page contains. The doctype can also tell browsers what kind of HTML version is in use, which determines what elements and attributes are allowed to be used by the web page. Browsers will also use the doctype to determine the rendering mode for the web page and to tell markup validators which set of rules to use. Browsers will try to automatically detect the doctype if no doctype is set; however, if browsers cannot correctly determine the doctype, the web page may not load completely correctly.

How to Declare a Doctype

The doctype can be declared using a special statement at the very top of the web page. The doctype should be the very first thing at the top of the web page so browsers know how to interpret the rest of the web page’s content. For modern HTML pages, the doctype statement looks like <!DOCTYPE html>. WordPress and other content management systems usually add this automatically at the top of web pages containing HTML content.




   200+ Design Templates + 1 Kick-ass SuperTheme
   6 WordPress Plugins + 2 Essential Services

Everything you need to build and manage WordPress websites in one Central place.

Leave a Reply

Your email address will not be published. Required fields are marked *