+ 2
What is <!Doctype HMTL>do?
It's literally just like <p></p> https://sololearn.com/compiler-playground/WGY7gs04Fuwb/?ref=app
11 Answers
+ 7
It tells the browser that the file is an html file
https://www.w3schools.com/tags/tag_doctype.asp
writing lllllllllllllllll outside of the <html> is just invalid code.
+ 2
If you type something notimportant in you file like 'lllllll' or anything else the programe will still work but it is not good to do not use tags
+ 1
By typing this you specify that this is a html5 file
+ 1
It tells the browser that you are writing html5
+ 1
You know how there're different types of html versions (html 5, html 4 ,html 2 and so forth) ,<!DOCTYPE html> tells the browser what html version to use <!DOCTYPE html> and in this case it works specifically with html 5 ,it's optional but it helps with rendering code also if you want different web browsers to parse your code the same way then ,its best to use it
also you can write outside <html></html> if you want ,it's possible but i advise against it as the browser could read your code wrong
https://www.sololearn.com/en/compiler-playground/WMKQvh0aeP5V
+ 1
Obakeng, I don't know zat
+ 1
Dud
0
But it still works like this:
https://sololearn.com/compiler-playground/WwQbmc2l6OwB/?ref=app
0
OOOOOOOOOOOOOOOOOO MMAAAAHHHHHHHHHH GGGGGGAAAAAAAAAAAAAAAAAAAWWWWWWWWWWWWWWDDDDD
https://sololearn.com/compiler-playground/W2Dlx9JMZ0KK/?ref=app
0
But tell me more đ
0
It gets displayed, BUT it is invalid html.
Browsers are very error-tolerant. But that doesn't mean it is valid html just because it looks fine.
You can check the validity on sites like this:
https://validator.w3.org/#validate_by_input+with_options
https://sololearn.com/compiler-playground/WRsZn45QUi6S/?ref=app