我在一个页面上有一些HTML代码,我不想删除这些代码,但在短期内使它们处于不活动状态。如何让浏览器忽略页面的某些部分,就像//
在某些编程语言中的工作方式一样?
发布于 2010-12-09 08:19:00
请看HTML注释:
<!-- comment -->
http://www.w3.org/TR/html401/intro/sgmltut.html#idx-HTML
当然,在不删除代码的情况下删除代码的正确方法是使用版本控制,它使您能够恢复过去的旧代码。不要养成在页面中堆积被注释掉的代码的习惯,这并不有趣。:)
发布于 2013-11-05 21:59:39
使用嵌套注释注释块:将内部(块)注释从"--“替换为"++”
<!-- *********************************************************************
* IMPORTANT: To uncomment section
* sub inner comments "++" -> "--" & remove this comment
*********************************************************************
<head>
<title>My document's title</title> <++! My document's title ++>
<link rel=stylesheet href="mydoc.css" type="text/css">
</head>
<body>
<++! My document's important HTML stuff ++>
...
...
...
</body>
*********************************************************************
* IMPORTANT: To uncomment section
* sub inner comments "++" -> "--" & remove this comment
*********************************************************************
-->
因此,最外层的注释会忽略所有“无效”的内部(块)注释。
发布于 2013-10-13 09:30:18
只需在其周围创建多行注释即可。当你想要回它的时候,只需删除评论标签。
例如,<!-- Stuff to comment out or make inactive -->
https://stackoverflow.com/questions/4393699
复制相似问题