Home > Article > Web Front-end > How to comment code in html editor (shortcut key sharing)
HTML (Hypertext Markup Language) is the basic language for building Web pages. Adding comments in HTML code can let other developers understand the functions you want to implement and facilitate subsequent maintenance.
HTML comments are usually enclosed in <!-- -->
tags. To quickly add or remove comments, you can try using the following HTML comment shortcuts. These shortcut keys can help you greatly improve your coding efficiency.
It is very common to add comments in the code, and the reverse operation is equally important. To open comments within an HTML code block, you can use the following shortcut keys: ctrl /
.
After pressing ctrl /
, <!--
will be inserted at the beginning of the current line and --> will be inserted at the end of the line.
and include the selected text in the comment. This shortcut key is also very convenient when adding multi-line comments.
In order to close comments in an HTML code block, you can use the following shortcut keys: ctrl shift /
.
This shortcut key can add <!-- /-->
at the beginning of the current line and close the current comment block. If no text is selected, it will close everything within the current comment.
Finding comments in HTML files is also a fairly common task. To quickly jump to the next comment, you can use the following shortcut keys: ctrl .
.
After pressing ctrl .
, it will jump to the next comment block. If there are no comments, it will prompt "No comments found".
HTML tags usually start with a starting tag (such as <html>
) and an ending tag (such as </html>
). In large HTML files, it's easy to forget where some of the tags end.
The way to quickly jump to the closing tag in HTML code is to use the following shortcut keys: ctrl shift .
.
After pressing this shortcut key, it will jump to the end mark of the current start mark. If there is no unmatched end tag at the current position, "End tag not found" will be prompted.
To comment the entire line, you can use the following shortcut keys: ctrl alt /
.
After pressing this shortcut key, it will add <!--
at the beginning of the current line, -->
at the end of the line, and Comment out everything on the current line.
The above is the introduction of HTML comment shortcut keys. Knowing these shortcuts and using them frequently while coding will help optimize your coding efficiency.
The above is the detailed content of How to comment code in html editor (shortcut key sharing). For more information, please follow other related articles on the PHP Chinese website!