Why does my website work without the <!DOCTYPE html> tag?


#1

Question

Why does my website work without the <!DOCTYPE html> tag?

Answer

The <!DOCTYPE html> declaration is a mandatory instruction for the browser; it tells the browser which version of HTML the HTML document is written in, currently HTML5. Without the declaration, some browsers will render HTML5 content correctly, however, other browsers may render the HTML document in a previous version of HTML, and may cause other unexpected behavior (like affecting the CSS, scripts, etc).