What is the difference between <!-- This is a comment > and <!-- This is a comment --> because output were same | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

What is the difference between <!-- This is a comment > and <!-- This is a comment --> because output were same

13th Jul 2018, 8:06 AM
Akash Vishwakarma
Akash Vishwakarma - avatar
3 Answers
+ 5
Hello, Akash Vishwakarma ! "<!-- >" is wrong comment. Since you started the comment and did not close it "<!-- >". This is similar to the not closed paragraph tag <p><div> Hello, world! </div> Paragraph tag is not closed, nevertheless html will display this markup. The correct syntax for the comment looks like this: "<!-- -->". In xhtml this way will with comment "<!-- >" not work. Good luck!
13th Jul 2018, 8:15 AM
Alexander Sokolov
Alexander Sokolov - avatar
+ 1
<!DOCTYPE html> <html> <head> <title>Page Title</title> </head> <body> <!--Comment--> <!--not comment> </body> </html>
13th Jul 2018, 8:11 AM
Akib
Akib - avatar
+ 1
Alexander Sokolov Your "Correct syntax"-need fixing.
13th Jul 2018, 8:18 AM
Akib
Akib - avatar