I'm new here, pls can someone tell me how to comment

Tell us what’s happening:

Your code so far

<h1>Hello World</h1>


<p>Kitty ipsum dolor sit amet, shed everywhere shed everywhere stretching attack your ankles chase the red dot, hairball run catnip eat the grass sniff.</p>

Your browser information:

User Agent is: Mozilla/5.0 (Linux; U; Android 8.1.0; TECNO BB2 Build/O11019; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/70.0.3538.110 Mobile Safari/537.36 OPR/46.0.2254.145391.

Challenge: Comment out HTML

Link to the challenge:

A comment begins with a <!-- and ends with a -->. The code you have (which I believe is the starter code, has one big comment, commenting out everything. But the instructions say:

Comment out your h1 element and your p element, but not your h2 element.

So, how would you change this so the first and last element are commented, but not the middle one? As a hint, you’re going to need more than one comment.

1 Like

Notice that the comment has a beginning and an end. The beginning is the “<!-” and the end is the “->” which comments out anything in between these two. (please note: I had to take away the extra ‘-’ present in the actual comment ‘tag’, as if you comment out text in the replies of this forum using the correct syntax, it doesn’t show the commented out text in the reply)

So, the obvious way is to simply delete the end comment ‘tag’ and append it to the end of the first section you are supposed to comment out. Then start a new comment by adding “<!–” to the next tag you are supposed to comment out and adding an end comment ‘tag’ to the end.

Pro-tip for when you eventually work in a full IDE program (if you are unfamiliar, a professional development program. IDE stands for “Integreated Development Environment” basically a text editor with extensions that make software development faster and easier. The current most popular IDE is called Visual Studio Code from Microsoft) and in the IDE on freeCodeCamp, you can use the keyboard shortcut “ctrl + /” to comment and uncomment lines. So what I did in this exercise was uncomment the entire thing with the shortcut and then re-comment the lines requested for the exercise.

1 Like