是否可以嵌套HTML注释? [英] Are nested HTML comments possible?
本文介绍了是否可以嵌套HTML注释?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
按标题;是否可以在有效的HTML中嵌套注释?请参阅下面的示例...
< p>一些文本< / p&
<! - 评论1
< p>已批注html< / p&
<! - comment 2
//是否允许嵌套html注释?
注释结束2 - >
< p>更多评论了html< / p>
注释结束1 - >
< p>一些更多文字< / p>
似乎不是,有人知道我如何获得嵌套评论工作吗?
$解决方案
嵌套注释时,将 - 与 - 。取消嵌套时,请反转此过程。不是<! -
是禁止的,而是 -
。
as per the title; is it possible to have nested comments in valid HTML? see the example below...
<p>some text</p>
<!-- comment 1
<p>commented out html</p>
<!-- comment 2
// are nested html comment allowed?
end of comment 2 -->
<p>more commented out html</p>
end of comment 1 -->
<p>some more text</p>
It appears not, does anybody know how I could get nested comments to work?
Thanks in advance.
解决方案
When you nest a comment, replace "--" with "- -". When you un-nest, reverse the procedure. It's not the <!--
that is forbidden but the --
.
这篇关于是否可以嵌套HTML注释?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文