In the work of a programmer, you constantly have to make some notes in the form of comments in order to describe a part of the code or marks for the future. Each language has its own syntax, which is why when developing web pages, not knowing how to comment out a line or a small block at once in HTML is a common problem.
HTML comments
When developing a web page, sometimes it is necessary to temporarily hide part of the code or make a note for the programmer. In order not to use additional applications, for example, moving part of the code to another file, you need to know how to comment out a line in HTML.

Unlike most programming languages, HTML does not have a special function or tag for creating a single line comment. If you need to "hide" only one line or part of it, you have to use the classic language tools. However, there are several ways to do this.
Standard comment
Comment out the part in HTMLThe easiest way to code is by using special pairs of characters. Before the beginning of the comment, you must specify "". Thus, everything inside this construct will be hidden from the user when the page loads.

It is worth noting that when working with a comment, you must be extremely careful. When defining its boundaries, you need to check if any opening or closing tag has got into it, the second part of which has remained outside it - in this case, the page will not load correctly. Also, you cannot create several more within one comment - with this writing, the first signal for the completion of the commenting part will open the entire subsequent part of the hidden text.
Below is an example of correct spelling:
This is a comment.
Tag
In HTML, you can comment out lines using a special pair of tags -. It is specifically included in the language syntax for this purpose, but most popular browsers do not support it, with the exception of Internet Explorer 8.0. The tag is useful when some information needs to be hidden only for IE 8.0, 4.0 and earlier browser versions, and also as a temporary solution during development. The specific point here is that you can comment out part of the code only in the body of the page, that is, inside the tag.
In the example below, when loading the page in the specified browsers, a white sheet will be displayed, in other programs, the page will say "Thiscomment":
This is a comment
Out of the box
In addition to the classical methods, you can comment out code in HTML using specific methods. In addition to basic HTML language structures, script tags and style sheet tags are often specified in the body of the page. Each of them also has its own comment definitions.
Thus, if you enclose the necessary part of the code in one of the specified tags, then inside you can use other methods to comment out the part of the code on the HTML page. Such methods are practically not used in modern practice, however, for self-development or, if necessary, to exclude the possible appearance of text on the page, they can be applied.

When using a script tag or style sheet, comments can be either single-line or multi-line. The former are defined by the "" construct, which, from the moment these characters are written, comments on the entire remaining line. In order to hide part of the code, you should use the syntax description "/" to open, and "/" to close the comment. If the closing construction is not written after the "/" characters, then the entire remaining HTML code will be commented out.
This example shows a way to make custom comments:
/
This is a comment.
/