css規範<一>

來源:互聯網
上載者:User

標籤:html   strong   --   .class   推薦   code   one   input   .com   

詳見<http://www.cnblogs.com/hustskyking/p/css-spec.html>

1.每個樣式屬性後加 ";"------------方便壓縮公用程式"斷句"。

2.空格的使用

1 .hotel-content {2      display: none;
}

.選取器與 { 之前要有空格  

.屬性名稱的 : 後要有空格

.屬性名稱的 : 前不加空格

3.多選取器之間必須換行,這樣比較清晰,

a.btn, input.btn, input{      display:none;              }    

 4.Class中盡量不出現大寫字母,採用"-"分割,這樣比較清晰,

1 /* 正確的寫法 */2  .hotel-title {3      font-weight: bold; }
/* 不推薦的寫法 */4 .hotelTitle {5 font-weight: bold; }

5.不要將樣式寫成單行,這樣不方便注釋,

1 hotel-content {margin: 10px; background-color: #efefef;}

6.盡量不要用"*"來選擇元素

1 /*別這樣寫*/2 * {3     margin: 0;4     padding: 0; 5 }

因為:只有一部分元素在瀏覽器有預設的margin padding特性。
7.

 

css規範<一>

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

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.