DEV Community

Cover image for What the hell is <!DOCTYPE html>?

What the hell is <!DOCTYPE html>?

Amandeep Singh Malhotra on June 29, 2022

&lt;!DOCTYPE html&gt; &lt;!-- What the hell is this?? --&gt;&gt; &lt;html lang="en"&gt; &lt;head&gt; &lt;title&gt;Document&lt;/title&gt; &lt;/...
Collapse
 
thomasbnt profile image
Thomas Bnt ☕

Cool post about DOCTYPE! 👍🏼

Don't hesitate to put colors on your codeblock like this example for have to have a better understanding of your code 😎

console.log('Hello world!');
Enter fullscreen mode Exit fullscreen mode

Example of how to add colors and syntax in codeblocks

Collapse
 
amanmalh profile image
Amandeep Singh Malhotra

Hey Thomas, since was my first post at dev.to, I was not aware of this. Thanks for your input. :)

Collapse
 
thomasbnt profile image
Thomas Bnt ☕

Oh don't worry! Very nice first post! And welcome to DEV! 👋🏼🚀

Thread Thread
 
dragat19 profile image
Albert Sanchez • Edited
console.log('hi'); 
Enter fullscreen mode Exit fullscreen mode
Collapse
 
pengeszikra profile image
Peter Vivo

I take look my old cv (around 2008) doctype and that was:

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
Enter fullscreen mode Exit fullscreen mode

When debugged :

console.dir(document.doctype)

{
  publicId: "-//W3C//DTD HTML 4.0//EN"
  systemId: "http://www.w3.org/TR/REC-html40/strict.dtd"
...restOfDoctype
}
Enter fullscreen mode Exit fullscreen mode

Saddly my old flash animation and program does not run in modern browser, I lost them, just keep the doctype.

Collapse
 
randellbrianknight profile image
Randell Brian Knight

Very nice article about DOCTYPE! 🎉 It's good to have some useful background information about these topics. Thank you, Amandeep 😎

Collapse
 
amanmalh profile image
Amandeep Singh Malhotra

Thank you 🙂

Collapse
 
kunalkeshan profile image
Kunal Keshan

Awesome! didn't know about the quirks mode fallback if the DocType is not mentioned.

Collapse
 
craftyminer1971 profile image
CraftyMiner1971

Thanks for the simple explanation of the DocType! I'm so glad that the W3C people simplified the DocType, cos i would not be able to remember all that fancy code that went into the former starting line for HTML files.

Collapse
 
amanmalh profile image
Amandeep Singh Malhotra

Thank you for going through this article. I have written another article which explains the this keyword in javascript. If you'd like to explore it, please go through this link. Thanks! ✌️

Collapse
 
kithminiii profile image
Kithmini

Interesting Article

Collapse
 
atulcodex profile image
🚩 Atul Prajapati 🇮🇳

In starting days of my learning web development i have asked several times to my institute teacher but they are unable to solve my curiosity 😌 thanks for your priceless effort 🙏🙏 shatsriya a kal 🙏

Collapse
 
uponthesky profile image
UponTheSky

Nice Investigation! It was really informative!

Collapse
 
yongchanghe profile image
Yongchang He

This is interesting!

Collapse
 
invalidlenni profile image
InvalidLenni

Thanks! I didn't know that, but now I know that! Nice post about <!DOCTYPE>

Collapse
 
wjplatformer profile image
Wj • Edited

Too detailed for 1 line of code 🤯. Good practice though especially when it comes to bigger stuff to discuss about.

Collapse
 
andrewbaisden profile image
Andrew Baisden

Nicely done good explanation.

Collapse
 
amanmalh profile image
Amandeep Singh Malhotra

Thank you 🙂

Collapse
 
imonem profile image
imonem

I love history lessons, keep'em comin'

Collapse
 
stevob profile image
Steven Barrios

This was a great post!

Collapse
 
comandeer profile image
Tomasz Jakut

Older HTML versions weren't actually based on SGML. That was just the theory but it wasn't done in practice. Otherwise it would require browsers to fetch all these .dtd files to parse HTML elements correctly – especially if someone came up with their own one. Parsing rules were more likely just hardcoded into the browsers and later just codified in HTML5 spec.

BTW DTD-based DOCTYPEs created one other issue: DDOS-ing W3C's servers ;)

Collapse
 
forgamertt profile image
forgamertt

pg slot auto สล็อต ฝากถอนออโต้ ไม่มีขั้นต่ำ ฟรีเครดิต ทดลองเล่นฟรี พีจีสล็อต รวดเร็ว ปลอดภัย รองรับ ทรูมันนี่ ทรูวอลเล็ท ลิขสิทธิ์แท้ ระบบ AUTO มีดีที่ มีระบบเสถียร และความรวดเร็ว

Collapse
 
baenencalin profile image
Calin Baenen • Edited

Does "Quirks Mode", ðe name, refer to ðe fact each browser handles þings differently?
I'd assume "yes", but it could mean someþing different.

Collapse
 
fongiliz profile image
p

Wow !!! It’s amazing
play game for relax and win get money

PG Slot

Collapse
 
patwalan_yaiyapong_4da5fe profile image
Patwalan Yaiyapong • Edited

Wow !!! It’s amazing
play game for relax and win get money

PG Slot

Collapse
 
dgavarogers profile image
Ava Rogers

Thats HTML5

Collapse
 
carneirodotdev profile image
Luiz Carneiro

Nice and simple! :) Enjoyed it!

Collapse
 
tr11 profile image
Tiago Rangel

Interesting!

Collapse
 
patwalan_yaiyapong_4da5fe profile image
Patwalan Yaiyapong • Edited

Thank you
Wow !!! It’s amazing
play game for relax and win get money

PG SLOT

Collapse
 
fongiliz profile image
p • Edited

Thank you
Wow !!! It’s amazing
play game for relax and win get money
PG SLOT