天天看點

随手一記-css

CSS屬性書寫順序(重點)

生活中衡量一個人有氣質:

穿着打扮 舉止言行 等等

程式設計中如何衡量一個人的代碼能力:

規範标準 優雅高品質 等等 一個詞形容 專業 從代碼中看出是否有經驗…

建議遵循以下順序:

布局定位屬性:display / position / float / clear / visibility / overflow(建議 display 第一個寫,畢竟關系到模式)

自身屬性:width / height / margin / padding / border / background

文本屬性:color / font / text-decoration / text-align / vertical-align / white- space / break-word

其他屬性(CSS3):content / cursor / border-radius / box-shadow / text-shadow / background:linear-gradient …

舉例:

.jdc {
   display: block;
   position: relative;
   float: left;
   width: 100px;
   height: 100px;
   margin: 0 10px;
   padding: 20px 0;
   font-family: Arial, 'Helvetica Neue', Helvetica, sans-serif;
   color: #333;
   background: rgba(0,0,0,.5);
   border-radius: 10px;
}