我总结和探索出的注释技巧

(从已经死了一次又一次终于挂掉的百度空间人工抢救出来的,发表日期2014-03-06)

 

在编码的工程中,如果遇到需要临时修改部分文件,但是事后有需要方便的取消更改,可以采用以下的方法来进行。

 

/*我的修改——————————————start

修改后的内容

/*我的修改——————————————end*/

 

/*原来的文件——————————————start*/

原来的内容

/*原来的文件——————————————end*/

 

通过更改两块代码的上方的注释结尾符号的位置来快速切换有效的代码块。如下:

 

/*我的修改——————————————start*/

修改后的内容

/*我的修改——————————————end*/

 

/*原来的文件——————————————start

原来的内容

/*原来的文件——————————————end*/

ps:上面中间的横线最好使用中文的横线,防止编译器警告。

//备注的内容 

上面的备注方式,不能使用在css中,虽然编译器会显示被注释成功的样式,但是浏览器解析时,会不解析此注释下一行的样式代码。

 

/*commented by *** on 140621 被注释的内容 */

采用以上做法,同一天的修改都采用以上做法,方便你进行日后管理。在搜索框输入commented by *** on 140621就能看到同一天修改的内容(一处修改往往涉及到好几处修改)

 

<!--第一层的注释

第一层的注释

</!--第二层的注释--/>

-->

注释中的注释,采用以上方法破坏掉注释结构,同时最完美的保留注释痕迹。

 

==============================================================================

示例:

 

CSS注释:

————

 

/*动态消息滚动样式——————————————————————————————start

#latest-news-index{ float:left; height:45px; background:url("images/last-news-bg.gif") no-repeat; width:auto !important; margin:0px auto; }

#latest-news-index_r{ float: right; height:45px; background:url("images/last-news-bg.gif") no-repeat; width:auto !important; margin:0px auto; }

.bound{ width:482px; overflow:hidden;margin-left: 20px;float: left}

.latest-news{ width:472px; height:35px; float:left; overflow:hidden; }

.latest-news a{ color:#666;}

.latest-news .title{width:80px;height:35px; margin:12px 5px 0px 0px; float:left;padding-left: 10px}

.latest-news .title a{font-weight:bold; color:#BB0000;}

.latest-news .newscontent{width:382px; height:35px; float: none; margin-left: 95px; margin-top: -103px;}

.latest-news .newscontent div{ height:35px; line-height:35px;line-height:35px\0;*line-height:12px;_line-height:35px; overflow:hidden;}

.latest-news .newscontent div a:hover{color: #F00}

/*动态消息滚动样式——————————————————————————————end*/

 

/*静态消息样式——————————————————————————————start*/

#latest-news-index{ float:left; height:45px; background:url("images/last-news-bg.gif") no-repeat; width:auto !important; margin:0px auto; }

#latest-news-index_r{ float: right; height:45px; background:url("images/last-news-bg.gif") no-repeat; width:auto !important; margin:0px auto; }

.bound{ width:482px; overflow:hidden;margin-left: 20px;float: left}

.latest-news{ width:472px; height:35px; float:left; overflow:hidden; }

.latest-news a{ color:#666;}

.latest-news .title{width:80px;height:35px; margin:12px 5px 0px 0px; float:left;}

.latest-news .title a{font-weight:bold; color:#BB0000;}

.latest-news .newscontent{width:382px; height:35px; float: none; margin-left: 85px;margin-top: 2px;}

.latest-news .newscontent div{ height:35px; line-height:35px;line-height:35px\0;*line-height:12px;_line-height:35px; overflow:hidden;}

.latest-news .newscontent div a:hover{color: #F00}

/*静态消息样式——————————————————————————————end*/

 

 

html注释:

————

 

<!--动态滚动html代码——————————————————————————————start

<div style="height:35px; overflow:hidden;"><a href="jxs.php" target="_blank">食品招商</a>、<a href="zhaoshang.php" target="_blank">媒体招商</a>、<a href="shop.php" target="_blank">促销品</a></div>

<div style="height:35px; overflow:hidden;"><a href="shop.php?cid=717&classid=727&jid=0" target="_blank">即期尾货</a>、<a href="shangbiao.php?classid=235" target="_blank">商标转让</a>、<a href="job.php" target="_blank">人才招聘</a></div> 

<!--动态滚动html代码——————————————————————————————end-->

 

<!--静态横条html代码——————————————————————————————start-->

<div style="height:35px; overflow:hidden;"><a href="jxs.php" target="_blank">食品招商</a>、<a href="zhaoshang.php" target="_blank">媒体招商</a>、<a href="shop.php" target="_blank">促销品</a>、<a href="shop.php?cid=717&classid=727&jid=0" target="_blank">即期尾货</a>、<a href="shangbiao.php?classid=235" target="_blank">商标转让</a>、<a href="job.php" target="_blank">人才招聘</a></div>

<!--静态横条html代码——————————————————————————————end-->

posted @ 2015-05-26 09:45  幻想家~  阅读(296)  评论(0编辑  收藏  举报