我们如何在HTML代码中添加评论?

WBOY
Lepaskan: 2023-08-19 19:29:29
ke hadapan
1607 人浏览过

我们如何在HTML代码中添加评论?

In this article we are going to learn about how do we add a comment in HTML code. Let’s dive into the article for getting better understanding on adding comment in HTML code.

要在HTML代码中添加注释,请使用注释标签(!— Comment—>)。这是一种良好的编码实践,使编码人员和读者都能从理解代码的帮助中受益。理解复杂代码的步骤非常有帮助。在调试代码时,注释标签非常有用。

  • It is a straightforward bit of code that web browsers wipe off (ignore), meaning they do not appear.

  • Understanding the purpose of a piece of code, particularly in complex source code, is helpful to both coders and readers.

Syntax

Following is the syntax for comment in HTML


Salin selepas log masuk

Let’s consider the following examples to get clear idea on how do we add a comment in HTML code.

单行注释

Single line comment is given inside the () tag.

Let’s look into the following example

Example

的中文翻译为:

示例

In the following examples we are using the single line comment.




   
   

TutorialsPoint

The Best E-Way Learning

Salin selepas log masuk

当脚本执行时,它将生成一个输出,在网页上显示没有注释的文本。

Multi-line Comment

The syntax (!- ->) can be used to specify several lines. In essence, it is the same as the syntax for single-line comments; the only difference is that the first half of the comment ("->") is appended when the intended comment line ends.

Example

的中文翻译为:

示例

Considering the following example, where we are using the multi line comment tag.



   
      
      

MSD

The Best Finisher

Salin selepas log masuk

运行上述脚本后,它将在网页上生成包含脚本中使用的文本的输出。

使用标签

An HTML "comment" tag once existed, but none of the current browsers support it.

Example

的中文翻译为:

示例

查看下面的示例,我们正在使用标签。



   
      Heading tag
      

DUCATI

Paragraph tag

The Fastest Bike

Salin selepas log masuk

When the script gets executed, it will generate an output displaying the text used in the code on the webpage along with the comments used by tag as modern browsers won’t support it.

以上是我们如何在HTML代码中添加评论?的详细内容。更多信息请关注PHP中文网其他相关文章!

sumber:tutorialspoint.com
Kenyataan Laman Web ini
Kandungan artikel ini disumbangkan secara sukarela oleh netizen, dan hak cipta adalah milik pengarang asal. Laman web ini tidak memikul tanggungjawab undang-undang yang sepadan. Jika anda menemui sebarang kandungan yang disyaki plagiarisme atau pelanggaran, sila hubungi admin@php.cn
Tutorial Popular
Lagi>
Muat turun terkini
Lagi>
kesan web
Kod sumber laman web
Bahan laman web
Templat hujung hadapan
Tentang kita Penafian Sitemap
Laman web PHP Cina:Latihan PHP dalam talian kebajikan awam,Bantu pelajar PHP berkembang dengan cepat!