评论中的HTML评论? [英] HTML comments within comments?

查看:214
本文介绍了评论中的HTML评论?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有多种方法可以评论多行...在其中已有一些注释吗?

Is there a way to comment multiple lines... which already have some comments in them?

ie

<html>
<!-- Multi-line comment begin
  <head>
    <!-- This script does abcxyz -->
    <script>...</script>
  </head>
  <body>
    Hello world!
  </body>
Multi-line comment end -->
</html>

似乎即使SO的语法hilighting也不会接受这个...

It seems that even SO's syntax hilighting won't accept this...

推荐答案

我认为关键点是:


Note that comments are markup.

http://www.w3.org/TR/html4/intro/sgmltut.html#h-3.2.4

这不是有效的标记:

<div <span/> />

...所以你也没有提到。

... so neither is the one you mention.

由于我的所有网站都是PHP编写的,我通常使用PHP注释掉代码:

Since all my sites are written in PHP I normally comment out code with PHP comments:

<?/*?>
<div>...</div>
<p>...</p>
<?*/?>

也许你可以使用类似的伎俩。

Perhaps you can use a similar trick.

这篇关于评论中的HTML评论?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆