VS Code is not commenting. Has anyone ever come across this problem?

Asked

Viewed 125 times

-4

When I add snippets of comments in the code VS Code does not correctly translate them.

<!DOCTYPE html>
<html lang="pt-BR">
    <head>
        <meta charset="UTF-8">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <meta http-equiv="X-UA-Compatible" content="ie=edge">
         //comentario..
         /* comentario 2 */

         <title>Design Layout Responsivo</title>
    </head>
    <body>

    </body>
</html>

Image of the code

Saida do trecho do codigo acima

  • Please put your source code there.

  • <!DOCTYPE html> <html lang="en-BR"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-Scale=1.0"> <meta http-equiv="X-UA-Compatible" content="ie=edge"> ///comment. /* comment 2 */ <title>Responsive Layout Design</title> </head> <body> </body> </html>

  • Probably the problem may be a quotation mark that may be broken in your code, and so the comment will not work, not always the problem is in Vscode, can be in the code, try commenting on a blank file and see if it works.

1 answer

1

HTML comments are made by opening the tag <!-- and closing in -->. Example:

 <!-- comentario.. --> 
 <!-- 
      comentario 2
      segunda linha
 -->

// and /* */ are for javascript (and other languages). Example javascript:

<script>
    //comentario..
    /* comentario 2 */
</script>
  • Thank you very much.... to coming from another language rsrs...was really worth

  • 2

    If you answered the question, mark the answer.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.