FAQ: Learn HTML - Common HTML Elements - Comments

This community-built FAQ covers the “Comments” exercise in Codecademy’s lessons on HTML.

Here are the most popular community questions on the exercise Comments:

Join the Discussion. We Want to Hear From You!

Have a new question or can answer someone else’s? Reply (reply) to an existing thread!

Agree with a comment or answer? Like (like) to up-vote the contribution!

Need broader help or resources about HTML in general? Go here!

Want to take the conversation in a totally different direction? Join our wider discussions.

Learn more about how to use this guide.

Found a bug? Report it!

Have a question about your account, billing, Pro, or Pro Intensive? Reach out to our support team!

None of the above? Find out where to ask other questions here!

1 Like

Other FAQs

The following are links to additional questions that our community has asked about this exercise:

  • This list will contain other frequently asked questions that aren’t quite as popular as the ones above.
  • Currently there have not been enough questions asked and answered about this exercise to populate this FAQ section.
  • This FAQ is built and maintained by you, the Codecademy community – help yourself and other learners like you by contributing!

Not seeing your question? It may still have been asked before – try searching for it by clicking the spyglass icon (search) in the top-right of this page. Still can’t find it? Ask it below by hitting the reply button below this post (reply).

1 Like

As someone who has written a bit of Html, what are some specific things you tend to leave comments on both for yourself and/or others?

I use it as a kinda of pointer. So when I create a new div which I’m going to put content in, I’ll put a comment saying what I’m using it for, like so:

<!-- Div for updating score-->
<div id="score">
Score: 0
</div>

It’s a nice pointer for me or other people to see as the scroll through the code, Oh hey, that’s where that div is and that’s what it does.

2 Likes

Thanx for the reply @stevencopeland I was thinking much the same way! It would be super useful for labeling containers and things of that nature. I’m just now starting out and hoping maybe I will get some input from experienced devs that may show other useful ways to use these comments that shed light on instances that my inexperienced self might use down the road to avoid problems. Comments seem like a very versatile tool.

3 Likes

Hey,

I work in a Japanese company (and plan on opening my own up here soon !!) But I was wondering with the <!-- comments thing, can you use other languages in there? Some of my coworkers can’t speak English well enough to suddenly be leaving English comments in the code.

Thanks

It’s important to keep in mind that your comment can be read in the page source by anyone accessing the site, so don’t leave any sensitive information in comments.

Once finished, if site users inspect the code of the site, will they be able to see all of the comments in the code?

While you are writing the code, there are certain practice that needs to be developed.

For example:

What is something new you learnt while creating that code.
What is something that your code does and is a little but clever.
Is there a point in your code where you got stuck!
This is the part of the code I need to update regularly.
This part of the code needs to be revised or updated.

These examples would make you insert the comments at places which would be easier for you and others as well.