HTML Comment Tag HTML注释标签

The comment tag <!–   –> is used for creating comments within your HTML code. This is a very useful tool for both new and experienced coders to make notations which will help the coder remember what different sections of code are for.

注释标签<!—->用于在HTML代码中创建注释。对于新手和有经验的程序员来说,这是一个非常有用的工具,可以帮助他们记下代码的不同部分。

The comment tag <!–   –> is not actually an HTML element (it is specified elsewhere in the HTML specifications). However, comments are an integral part of any HTML document. Comments can only be seen in code view and are not displayed to the end users. These comments can assist the author in understanding the code. This is particularly useful if there is a lot of code. Comments can also help other authors understand the code used in a specific webpage. This can be helpful when multiple web developers work collaboratively on the HTML code of a website.  Comments also serve as a reminder to web programs about what various parts of the HTML code are for in a document that they have not updated for a long time.

注释标签<!—->实际上不是HTML元素(在HTML规范的其他地方指定),但是,注释是任何HTML文档不可分割的一部分。注释只能在代码视图中看到,不会显示给最终用户。这些注释可以帮助作者理解代码。尤其有很多代码的时候极其有用。注释还可以帮助其他作者理解特定网页中使用的代码。当多个web开发人员协作处理一个网站的HTML代码时,这会很有帮助。注释还可以提醒web程序,HTML代码的各个部分在文档中的作用是什么,而这些文档已经很长时间没有更新了。

Syntax语法:

The comment tag <!–   –> does not have a separate opening and closing tag. Instead the comment tag is written as <!– Comment Here –> with the comments inserted inside the tag. Note that the exclamation mark is only used at the start tag and the comment are inserted into the empty space.

注释标签<!—->没有单独的开始和结束标记。相反,注释标记写为<!– Comment Here –>将注释插入标签中。请注意,感叹号仅用于开始标签,注释插入到空白处。

Example例: 

pastedGraphic.png
Instructions: Retype this code in an HTML editor and then load the webpage in a browser of your choice. Then once you have loaded the page try experimenting with the code. Making a few small changes and then preview how those changes affected your webpage. Once you are comfortable with this HTML Tag you should proceed to the next example.
说明:在HTML编辑器中重新键入此代码,然后在选择的浏览器中加载网页。加载页面后,尝试使用代码进行实验。进行一些小的更改,然后预览这些更改如何影响您的网页。一旦熟悉了这个HTML标记,就继续下一个示例。

Proceed to the next example: Document Type Declaration