+ 2

What is <!Doctype HMTL>do?

It's literally just like <p></p> https://sololearn.com/compiler-playground/WGY7gs04Fuwb/?ref=app

12th Sep 2024, 6:58 AM
Wai Yip Tng
Wai Yip Tng - avatar
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.
12th Sep 2024, 8:58 AM
Lisa
Lisa - avatar
+ 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
13th Sep 2024, 10:53 AM
Fateme Biglari
Fateme Biglari - avatar
+ 1
By typing this you specify that this is a html5 file
12th Sep 2024, 6:52 PM
Khalid Afghanmal
Khalid Afghanmal - avatar
+ 1
It tells the browser that you are writing html5
13th Sep 2024, 5:57 PM
Mohammad Shehadeh
+ 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
14th Sep 2024, 7:21 AM
Obakeng Nakedi
Obakeng Nakedi - avatar
+ 1
Obakeng, I don't know zat
18th Sep 2024, 6:11 AM
Wai Yip Tng
Wai Yip Tng - avatar
+ 1
Dud
18th Sep 2024, 6:12 AM
Wai Yip Tng
Wai Yip Tng - avatar
12th Sep 2024, 10:49 AM
Wai Yip Tng
Wai Yip Tng - avatar
0
OOOOOOOOOOOOOOOOOO MMAAAAHHHHHHHHHH GGGGGGAAAAAAAAAAAAAAAAAAAWWWWWWWWWWWWWWDDDDD https://sololearn.com/compiler-playground/W2Dlx9JMZ0KK/?ref=app
12th Sep 2024, 10:53 AM
Wai Yip Tng
Wai Yip Tng - avatar
0
But tell me more 😁
12th Sep 2024, 12:30 PM
Wai Yip Tng
Wai Yip Tng - avatar
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
12th Sep 2024, 1:43 PM
Lisa
Lisa - avatar