css書寫規範

介紹css的書不少文章也不少,可是不多有說起css的書寫規範,一個好的規範,不但能夠指導咱們的思路還具有良好的語意。css

書寫順序

  1. 位置屬性(position,display, float, top, right, z-index等)
  2. 大小(width, height,padding, margin等)
  3. 文字系列(font, line-height, color, letter-spacing等)
  4. 背景(background, border等)
  5. 其餘(animation, transition等)

其餘

  1. 屬性縮寫(padding, border等)
  2. 小數點捨去0(.5em)
  3. 選擇器簡寫,中橫線代替下劃線
相關文章
相關標籤/搜索