How to comment in HTML (with images)

Table of contents:

How to comment in HTML (with images)
How to comment in HTML (with images)

Commenting on your code allows you to leave reminders and explanations for yourself and any other coders who will be working on the page. Commenting can also be used to quickly turn off parts of your code when you're testing or working on a new feature that isn't ready yet. Learning how to properly use comments will help you and your colleagues write code more effectively.


795094 1

Step 1. Insert a single line comment

Comments are designated by the <! -- and. You can quickly insert comments to remind yourself of what's going on in the code.

  Commentary test   This code forms a paragraph

Here is the website

Make sure there is no space inside the comment tag. For example, <! - will not activate the comment function. Inside the tags, you can put as many spaces as you want

795094 2

Step 2. Create a multi-line comment

Your comments can span multiple lines, which is useful for explaining complex code, or for isolating large chunks of code.

  Commentary test   Your comment can be as long as you want. Anything inside the comment tags will not affect the page code.

Here is the website

795094 3

Step 3. Use the comment function to quickly deactivate code

If you're trying to find a bug or want to prevent code from executing on the page, you can use the comment feature to quickly block it. So you can easily restore the code by removing the comment tag.

   Commentary test   

Look at these pictures

At this time, this image is not showing

795094 4

Step 4. Use the comment function to hide scripts on unsupported browsers

If you are programming in JavaScript or VBScript, you can use the comment function to hide the script on browsers that do not support it. Include the comment at the start of the script, and end it with // to make sure the script works on browsers that actually support it.


Popular by topic