How do browsers determine which mode to use?
For HTML documents, browsers use a DOCTYPE in the beginning of the document to decide whether to handle it in quirks mode or standards mode.
The DOCTYPE shown in the example, <!DOCTYPE html>, is the simplest possible, and the one recommended by current HTML standards. Earlier versions of the HTML standard recommended other variants, but all existing browsers today will use full standards mode for this DOCTYPE, even the dated Internet Explorer 6. There are no valid reasons to use a more complicated DOCTYPE. If you do use another DOCTYPE, you may risk choosing one which triggers almost standards mode or quirks mode.
Make sure you put the DOCTYPE right at the beginning of your HTML document. Anything before the DOCTYPE, like a comment or an XML declaration will trigger quirks mode in Internet Explorer 9 and older.
The only purpose of <!DOCTYPE html> is to activate no-quirks mode. Older versions of HTML standard DOCTYPEs provided additional meaning, but no browser ever used the DOCTYPE for anything other than switching between render modes.
https://developer.mozilla.org/en-US/docs/Web/HTML/Quirks_Mod...My point was its silly because the html self-defines being html the second you open the <html> tag, because what else could it even be?
If you don't care your site potentially becomes unusable broken shit outside of the specific browser you develop it on, there's no real use.
That said, HN works fine.
If a web page does not have the correct doctype, browsers run it in quirks mode instead of standards mode. If a web developer is fine with their websites running in quirks mode, they are not a good web developer, and you should probably stay away from them.
I just wish the Tailwind community (and those from other big-ass CSS frameworks) would internalize this concept. It feels so unintuitive to have your compiled HTML just element after element of class="lg:block fixed inset-0 top-[3.8125rem] drop-shadow-md justify-center hunter2-blue overflow-hidden pointer-events-none"
...especially when elements like <p> have the exact same giant class definition throughout an entire page.
But "<center>" is depreciated now? Come on.
"Width" and "height" attributes too? To what purpose? They are clear, easy to use, and apparently still widely supported with no issue.
And yet to see a browser that actually cares about DOCTYPE...usually its pretty obvious when the next line is <html>