按照标题;是否可以在有效的HTML中嵌套注释?请参阅下面的示例...
<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>
似乎没有,有人知道我如何才能使用嵌套注释吗?
最佳答案
嵌套注释时,将“-”替换为“--”。取消嵌套时,请执行相反的步骤。禁止的不是<!--
而是--
。
例:
<!-- some stuff
<!- - some inner stuff - ->
<!- - a sibling - ->
the footer -->
关于html - 可以嵌套HTML注释吗?,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/442786/