CSS屬性書寫順序

來源:互聯網
上載者:User

每寫css時也會停頓下,組織下順序怎麼寫,沒有仔細分析過,時間長了就形成預設的習慣了,純粹為了好尋找改寫方便,大概是這樣:

position: ;<br />margin: ;<br />padding: ;<br />width: ;<br />height: ;<br />border: ;<br />background: ;</p><p>color: ;<br />font-size: ;<br />z-index: ;<br />display: ;

只列了常用的一些,看了歲月如歌的《CSS中屬性的書寫順序》,覺得分析的不錯,借鑒下。

 

 

  1. 影響文檔流的屬性(比如:display, position, float, clear, visibility, table-layout等)
  2. 自身盒模型的屬性(比如:width, height, margin, padding, border等)
  3. 排版相關屬性(比如:font, line-height, text-align, text-indent, vertical-align等等)
  4. 裝飾性屬性(比如:color, background, opacity, cursor等)
  5. 產生內容的屬性(比如:content, list-style, quotes等)

 

相關文章

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.