我個人的javascript和css命名規範

來源:互聯網
上載者:User

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;
     width: 0;
     height: 0;
}4.屬性分組寫盒子模型屬性,定位屬性,文本和字型屬性

相關文章

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.