原文:Comment out HTML – Code Example,作者:Kolade Chris
在你的代码中添加注释是一个很好的做法,因为它使你的代码更具有可读性,易于理解。
注释不会运行,因为它们会被编译器和解释器忽略。
在这篇文章中,我将向你展示如何注释你的 HTML 代码,这样你就可以帮助自己和团队成员理解你在做什么。
如何对 HTML 代码进行注释与其他编程语言有不同的符号来做多行和单行注释不同,在 HTML 中,你可以用同样的符号做多行和单行注释。
要注释 HTML 代码,请使用小于符号(<),后面是感叹号(!)、两个连字符(--)、注释内容、两个连字符(--)和大于符号(>)。
注释 HTML 的语法是这样的:
你可以用它来做单行注释:
Watch the Jabs
Our primary objective is to bring live boxing matches to fans all around
the world
Its not About the Fights Alone!
We also air documentaries specially made for the greats, lifestyle of
boxers, news, and more.
你也可以用它来做多行注释:
Watch the Jabs
Our primary objective is to bring live boxing matches to fans all around
the world
Its not About the Fights Alone!
We also air documentaries specially made for the greats, lifestyle of
boxers, news, and more.
只要不在标签内,你也可以把注释放在任何地方:
Watch the Jabs
Our primary objective is to bring live boxing matches to fans all around
the world
Its not About the Fights Alone!
We also air
documentaries specially made for the greats, lifestyle of boxers, news,
and more.
就是这些啦,现在你可以正确、安全地注释你的 HTML 代码了。
谢谢你阅读本文。