編碼規範,java編碼規範

來源:互聯網
上載者:User

編碼規範,java編碼規範
HTML文法

  • 用兩個空格來代替定位字元(tab) -- 這是唯一能保證在所有環境下獲得一致展現的方法。
  • 嵌套元素應當縮排一次(即兩個空格)。
  • 對於屬性的定義,確保全部使用雙引號,絕不要使用單引號。
  • 不要在自閉合(self-closing)元素的尾部添加斜線 --HTML5 規範中明確說明這是可選的。
  • 不要省略可選的結束標籤(closing tag)(例如,</li>或 </body>)
  • 引入 CSS 和 JavaScript 檔案
  • 根據 HTML5 規範,在引入 CSS 和 JavaScript 檔案時一般不需要指定 type 屬性,因為 text/css 和 text/javascript 分別是它們的預設值。

  • 聲明順序

    相關的屬性聲明應當歸為一組,並按照下面的順序排列:

    1. Positioning
    2. Box model
    3. Typographic
    4. Visual

    由於定位(positioning)可以從正常的文檔流中移除元素,並且還能覆蓋盒模型(box model)相關的樣式,因此排在首位。盒模型排在第二位,因為它決定了組件的尺寸和位置。

    其他屬性只是影響組件的內部(inside)或者是不影響前兩組屬性,因此排在後面。

    .declaration-order {  /* Positioning */  position: absolute;  top: 0;  right: 0;  bottom: 0;  left: 0;  z-index: 100;  /* Box-model */  display: block;  float: right;  width: 100px;  height: 100px;  /* Typography */  font: normal 13px "Helvetica Neue", sans-serif;  line-height: 1.5;  color: #333;  text-align: center;  /* Visual */  background-color: #f5f5f5;  border: 1px solid #e5e5e5;  border-radius: 3px;  /* Misc */  opacity: 1;}

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.