Start networking and exchanging professional insights

Register now or log in to join your professional community.

Follow

Is it Doctype mandatory to use in HTML5?

user-image
Question added by Mohamed Abdelnour , UI/UX Specialist , DXC Technology previously known as (Hewlett-Packard Enterprise)
Date Posted: 2015/05/28
Muhammad Butt
by Muhammad Butt , Software Project Manager , Newnet

It depends on the target browsers. Webkit-browsers, Firefox and Opera will handle HTML5 elements quite normally even if your doctype is not HTML5.

IE9 on the other hand (I bet you saw this coming), may behave entirely differently on another type of doctype. If IE9 is not in IE9 Standards mode (it could be in quirks, IE8 compat, whatever), it will not support the HTML5 features it does in IE9 standards.

So essentially your main concern is that you need to make sure all browsers go into strict standards mode. The easiest way to achieve this is to use the HTML5 doctype, since it will trigger standards mode in all browsers - including older browsers that don't actually support HTML5.

Rameez Ahmed Sayad
by Rameez Ahmed Sayad , .Net Consultant , Proximus Luxembourg

Muhammad answer describes it completely, it is only IE that depends so heavily on the DOCTYPE, from a ASP.NET web forms perspective , postbacks and AJAX calls might fail as the server generated scripts become incompatible.

Faisal Raza Faisal
by Faisal Raza Faisal , Web Design Project Manager , Kat systems

Yes, Because it defined that which version of HTML language is used.

More Questions Like This