How to make comments in html

Computers

Before learning how to make comments in html,It is necessary to understand what they are for. If you are interested in such information, you probably already know what html is, so we will not dwell on this issue. Some developers of web pages do not pay enough attention to the arrangement of comments in their codes. In one-page sites such a mistake, maybe, will go unnoticed. But when it comes to huge portals, small comments will save time and simplify your life. Plus, notes allow other developers to understand your code when an additional explanation is required.

comments in html

goal

Creating html-page sometimes can not do withoutThe confusing codes and eternally repeating tags. New classes, selectors, id-indiators, etc. All this can literally drive you crazy. Comments in html are created to alleviate the heavy burden of web developers. After all, when the site code stretches far down, it is difficult to remember what and where it is. It's the comments that help make small notes right in the html code that will not be visible to your users. Beginners rarely use this tag. But already experienced experts distinguish a huge, useful property of comments. This tag is especially effective when several developers are working on the code at once. Instead of asking questions every time and picking up your partner from work, you just need to review the comments.

html comments

Creature

To have a new line in your code withcomment, you need to add the following entry: <! - ->. This is what this tag looks like in html. All that is inside it will not be displayed on the users screen. Html comments should not be stretched into several lines and contain any code (this is considered a bad form). They should carry in themselves only some description of the developer's intentions regarding the insertion of this particular tag, attribute or value. Although among high-level masters there is an opinion that the code should be written in such a way that no additional explanations are required. But, unfortunately, not everyone has such a gift of writing html-pages.

creating a html page

Features

The <! - -> tag has some peculiarities. For example, you can add any other tags inside it, but you can not create nested comments. This will lead to an unexpected result. Comments in html are widely used for testing web pages. For example, when you need to look at a site without a specific tag, but you can not delete it, because it will be difficult to restore all the source code. In this case, you just need to put the necessary part of the page in the comments. And then the tag will be ignored by the browser. But it should be noted that all comments can be traced if you open the source code of the page. And this can be done by every user. Therefore, do not put any important information inside this tag.

Conclusion

Comments in html can help you and other webmasters understand your codes. But try to build your sites in such a way that an explanation to your pages is not required.