+ 15

HTML comments <!...> Or <!--...--> ?

As per many textbook's HTML comments are as follows <! comment section > but in sololearn and some other websites it is as follows <!-- comment section --> which is the correct one????

2nd May 2017, 6:20 AM
SUJITH
SUJITH - avatar
10 Réponses
+ 13
The correct HTML comment is the 2nd one <!-- ....... -->
2nd May 2017, 6:25 AM
Geoffrey L
Geoffrey L - avatar
+ 9
It should be <!--(blah blah blah)--> For some reason, maybe because they dont use traditional HTML
4th May 2017, 10:23 AM
👑 Prometheus 🇸🇬
👑 Prometheus 🇸🇬 - avatar
+ 5
First, since Internet Explorer deviates so much, their conditional comments are technically invalid for XML compliance standards as well as HTML's. Now my message: To be more correct, possibly off-topic, following up on the other two comments I see, I'm going to use my knowledge of XML in this (just in case you want an XML parser to validate the comments...). Comments start with "<!--" and ends with the FIRST instance of "-->" that is found, so nesting comments will produce invalid code. There must be absolutely ZERO instances of "--" between the start and there must be ZERO extra "-" after the start or before the end. Examples for the start of a comment."<!---" three dashes/hyphens or more is invalid, but "<!-- -" having a space or other valid character BEFORE a dash/hyphen spree is okay.
2nd May 2017, 2:41 PM
Katie (Ctrl-Alt-Cuteness)
Katie (Ctrl-Alt-Cuteness) - avatar
+ 4
this one is correct comment<!--comment-->
9th May 2017, 3:48 AM
Nikhil
Nikhil - avatar
+ 4
thé second one <!-- blablabla -->
20th Jul 2017, 12:29 PM
Amara Abdelghani
Amara Abdelghani - avatar
+ 4
the second option Is the correct <!--...-->
6th Oct 2018, 8:22 PM
Heriberto Domínguez
Heriberto Domínguez - avatar
+ 3
in html <!--comments allow--> is valid comment
20th Jul 2017, 3:22 AM
Ravi Prajapati
Ravi Prajapati - avatar
+ 3
@Malcolm Crowley, your iOS device is automatically converting them from - - to either — or – which means you should look in the system's settings and disable any auto-correct or similar features while using SoloLearn.
29th Sep 2017, 10:57 PM
Katie (Ctrl-Alt-Cuteness)
Katie (Ctrl-Alt-Cuteness) - avatar
+ 2
I’m stuck in the program at this test, valid answer coming back as invalid. </!— comments —>. For some reason on my ipad pro, the hyphens are entered look like a line as in the instructions i typed.
27th Sep 2017, 12:41 PM
Malcolm Crowley
Malcolm Crowley - avatar
0
<!__This is comment__
20th Jul 2020, 6:44 AM
Maqsuda Masharipova
Maqsuda Masharipova - avatar