|
|
|
|
|
by erikpukinskis
3682 days ago
|
|
Slightly off topic, is there really any practical reason to setting the DOCTYPE and all that? I just write <html><body></body></html> and get going. I know supposedly browsers will switch modes and stuff, but is it really important to set the mode if I don't even know what mode I would want? |
|
1. Old browsers. Some browsers had two modes, 'standards mode' and 'quirks mode'. The former had pages render as close to the spec as they could get it, the latter had them render in a way that let deprecated markup or browser specific hacks keep working. Some made it even more confusing with what the Wikipedia article calls 'amost standards mode', which mostly followed standards except for one specific quirk in regards to images inside table cells.
Doctypes had the browser switch between these modes, and lacking one often had it fall back to 'quirks mode' in old browsers.
https://developer.mozilla.org/en-US/docs/Quirks_Mode_and_Sta...
2. For markup validators to figure out what spec to validate the document against.
Edit: So yeah, important if you want your page to render half decently in old browsers or you're validating your HTML in some online tool.