htmlvalidation

How to fix consecutive hyphens did not terminate a comment error?


with the w3 validator (https://validator.w3.org) scan my project but that's found a error.

Error: Consecutive hyphens did not terminate a comment. -- is not permitted inside a comment, but e.g. - - is. At line 135, column 8 ↩

all of the that line :

</ul></div></div><!-- end #main-nav -->

Why I get this error? How can fix that?

Thank you


Solution

  • It is an old post but I've stumbled upon a similar problem.

    The validation error states that -- are not permitted INSIDE a comment so the following code will throw an error:

    <!-- Commented resource
    
    Some HTML here
    
    <!-- /comment stops here -->
    

    This code will not return a validation error:

    <!-- Commented resource
    
    Some HTML here
    
    /comments stop here -->
    

    This usually happens when you have somenthing with comments and then decide to comment everything and you leave the closing comment intact.