How to comment out code in HTML

Coding in HTML and looking for how to comment your code out? Here’s how to do it.

Use the Ctrl + / keys together.

Why would you need to comment out code in HTML? Well, if you are working on a huge project, and you need to add comments to help you remember what that function was for, or why you used an id and not a class, comments are great for that reason. When commenting out code in HTML, I like to make sure that I write the comments in a clear way that’s also easy to understand, because if I come back at a later time, I want to make sure that I still know what’s going on. Pro tip – Make comments short and to the point.

Here’s our sponsor of this blog: PremiereGoodsStudio, with a new product! If you’re a freelance developer working with clients, and you need a theme to speed up your process and create a beautiful website, try this theme out! With ready to edit HTML, CSS, and JS code, this responsive website is ready to go. Here’s the link.

Also, commenting out code in HTML is great for when other developers need to read your code. It’s nice to give a signal to them on what your code is about, because let’s be honest, we all write code different ways. Even HTML, being a simple coding language, when written by multiple people, can get confusing. So, by commenting out code in HTML, it helps speed up communication between team members.

I’ve also noticed that commenting out code in HTML helps me keep track of more complicated code, or when there’s a lot of stuff going on. Like if I was to build an e-commerce website, there’s a lot of small pieces that create each page. You have filters, section, product containers, labels, links, and more. So I like to comment out my code in HTML to help simplify things.

So, once again, if you’re looking for how to comment out code in HTML, simply use Ctrl + /. I hope this was able to help, and if you’d like, check out some of my other articles.

Once again, check out PremiereGoodsStudio for any custom web developer themes.


Leave a Reply

%d bloggers like this: