is <!doctype html> the same as <!--doctype html--> | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

is <!doctype html> the same as <!--doctype html-->

What's the difference? And how else can you use the former?

10th Apr 2020, 10:41 PM
Joy
2 Answers
+ 5
First is wrong and second is right
10th Apr 2020, 10:46 PM
A͢J
A͢J - avatar
+ 3
Comments are <!-- any text -->. But most browsers will also treat <! any text> as comment, although it isn't official syntax. From HTML5 standard: Comments must have the following format: The string <!-- Optionally, text, with the additional restriction that the text must not start with the string >, nor start with the string ->, nor contain the strings <!--, -->, or --!>, nor end with the string <!-. The string --> A DOCTYPE must consist of the following components, in this order: A string that is an ASCII case-insensitive match for the string <!DOCTYPE. One or more space characters. A string that is an ASCII case-insensitive match for the string html. Optionally, a DOCTYPE legacy string. Zero or more space characters. A U+003E GREATER-THAN SIGN character (>). // This was discussed today on dev.to All credit: https://dev.to/calin92540842/what-s-so-special-about-doctype-html-3cd6
10th Apr 2020, 10:47 PM
HNNX 🐿
HNNX 🐿 - avatar