Ton*_*y R 29 html comments multiline
有没有办法评论多行...已经有一些评论?
即
<html>
<!-- Multi-line comment begin
<head>
<!-- This script does abcxyz -->
<script>...</script>
</head>
<body>
Hello world!
</body>
Multi-line comment end -->
</html>
Run Code Online (Sandbox Code Playgroud)
似乎即使是SO的语法hilighting也不会接受这个......
Álv*_*lez 12
我认为关键在于:
请注意,注释是标记.
http://www.w3.org/TR/html4/intro/sgmltut.html#h-3.2.4
这不是有效的标记:
<div <span/> />
Run Code Online (Sandbox Code Playgroud)
......所以你提到的那个也不是.
由于我的所有网站都是用PHP编写的,因此通常会使用PHP注释注释掉代码:
<?/*?>
<div>...</div>
<p>...</p>
<?*/?>
Run Code Online (Sandbox Code Playgroud)
也许你可以使用类似的技巧.
不。结束评论标签 --> 将始终结束评论部分,因此如果您的评论包含评论,您所包含评论的结束标签将结束评论部分。
您可以在将要注释掉某些独特内容的部分中替换 -->,以便稍后再替换回 --> 如果您选择撤消注释。
如果您确实遇到了在某些无法控制的源 \xe2\x80\x93 处预渲染的 HTML \xe2\x80\x93 片段,其中包含注释,并且您需要确保它们都没有渲染在您的页面上,您始终可以使用如下标签将其包裹起来script,唯一的问题是,您不能以script这种方式注释掉标签。
<html>\r\n <head>\r\n </head>\r\n <body>\r\n <!-- multiline "comment" below using script type="text/html" -->\r\n <script type="text/html"> \r\n Hello world!\r\n <!-- Look at me, I\'m a comment :) -->\r\n <div>Yeah, whatever, I\'m an element..</div> \r\n </script>\r\n <span>Who cares, span is the man, the only visible one anyway!</span>\r\n </body>\r\n</html>Run Code Online (Sandbox Code Playgroud)\r\n如果你需要注释掉script标签,你可以使用 atextarea作为包装器,当然这样做,你不能注释掉textarea标签。
<html>\r\n <head>\r\n </head>\r\n <body>\r\n <!-- multiline "comment" below using textarea style="display:none;" -->\r\n <textarea style="display:none;">\t\r\n <script> \r\n alert("which won\'t show up.."); \r\n </script>\r\n Hello world!\r\n <!-- Look at me, I\'m a comment :) -->\r\n <div>Yeah, whatever, I\'m an element..</div> \r\n </textarea>\r\n <span>Who cares, span is the man, the only visible one anyway!</span>\r\n </body>\r\n</html>Run Code Online (Sandbox Code Playgroud)\r\n| 归档时间: |
|
| 查看次数: |
24651 次 |
| 最近记录: |