【发布时间】:2011-04-14 23:56:08
【问题描述】:
通常在用 html 编写视图模板时,我添加一些有用的 cmets 的习惯会导致在测试时花费大量时间。
考虑这段代码...
<!-- Here starts the sidebar -->
<div id="sidebar">
....
</div>
<!-- Here starts the main contents pane -->
<div id="main-contents">
...
</div>
<!-- Here starts the footer -->
<div id="footer">
...
</div>
现在,如果我必须隐藏视图模板的某些部分,对于 php,我只需选择所需的代码并放置单行 cmets(大多数情况下使用快捷键)。
但是,在 html 代码中,只有块 cmets 起作用,我最终删除了所有结束注释标记 (-->) 直到我希望注释发生的位置 - 像这样......
<!-- Here starts the sidebar
<div id="sidebar">
....
</div>
<!-- Here starts the main contents pane
<div id="main-contents">
...
</div>
<!-- Here starts the footer
<div id="footer">
...
</div>-->
然后当我完成测试时,我必须经历放回那些结束标签的痛苦。
有没有更好更省时的方式来阻止 HTML 中的评论?
【问题讨论】:
标签: html coding-style comments