[筆記]CSS樣式聲明順序,css樣式聲明順序

來源:互聯網
上載者:User

[筆記]CSS樣式聲明順序,css樣式聲明順序

來自Bootstrap中文網編程規範

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

.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;}

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

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

完整的屬性列表及其排列順序請參考 Recess。

聯繫我們

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