我个人的javascript和css命名规范

1.基本对象

Array,arr

Boolean,bool

Data,date

Number,num

String,str

RegExp,reg

Functions,没有后缀名

Event,event

Object,obj

函数的参数,Arguments,arg

尽量能表示什么类型就有什么类型后缀,一个是Button的引用,后缀就是btn

2.声明一个对象或函数的时候,注释它的调用堆栈。
3.声明函数时,注释(1)函数作用(2)函数参数类型和作用
 
------------------CSS部分
1.网页布局模块要注释。
/*---GLOBAL---*/
  /*--Structure--*/
  /*--Typographic--*/
  /*--Forms--*/
  /*--Tables--*/
/*---HEADER---*/
/*---NAV---*/
  /*--Primary--*/       
  /*--Secondary--*/  
  /*---CONTENT---*/  
/*---SIDEBAR---*/  
/*---FOOTER---*/
2.什么时间,谁做了什么。
/*----TITLE: Main screen styles | AUTHOR: EPL | UPDATED: 03/23/10 by EPL----*/
3.样式重置
/*---RESET---*/ 
html, body, div, span, applet, object, iframe, h1, h2, h3, h4, h5, h6, p, blockquote, pre, a, abbr, acronym, address, big, cite, code, del, dfn, em, font, img, ins, kbd, q, s, samp, small, strike, strong, sub, sup, tt, var, dl, dt, dd, ol, ul, li, fieldset, form, label, legend, table, caption, tbody, tfoot, thead, tr, th, td {    
  margin: 0;    
  padding: 0;    
  border: 0;    
  outline: 0;    
  font-weight: inherit;    
  font-style: inherit;    
  font-size: 100%;    
  font-family: inherit;    
  vertical-align: baseline; 
}
li { list-style:none; }/*消除li自带的小黑点 */
img { border:none; }/*消除图片的边框,主要是兼容IE8以下浏览器*/
a { text-decoration:none; }
a:hover { text-decoration:underline; }
/*清除浮动*/
.clear2:after { content:'.'; display:block; clear:both;height: 0;visibility: hidden; }
html body div.clear3,
html body span.clear3
{
     background: none;
     border: 0;
     clear: both;
     display: block;
     float: none;
     font-size: 0;
     margin: 0;
     padding: 0;
     overflow: hidden;
     visibility: hidden;
      0;
     height: 0;
}
4.属性分组写
盒子模型属性,定位属性,文本和字体属性

合乎自然而生生不息。。。
原文地址:https://www.cnblogs.com/samwu/p/2785351.html