css 簡寫技巧

來源:互聯網
上載者:User

標籤:add   tac   ges   png   bottom   att   nbsp   round   lis   

一些css  簡寫技巧

1.font 的簡寫  font 有可選選項和必選選項 如 font-style , font -weight , font-variant ,可寫可不寫, 但如果寫的話必須前置 放到 font-size 和 font-family 前面。 而必選的  font-family   必須放到最後面 

p{ font-style:italic; font-weight:bold; font-variant:small-caps; font-size :12px; font-family:Arial;   }可以簡寫成 p{font:italic bold small-caps 12px Arial;}

 2 background 的簡寫

.div{background-color: #000;background-image: url(images/bg.gif);background-repeat: no-repeat;background-attachment:fixed;background-position: top right;}簡寫成.div{background: #000 url(images/bg.gif) no-repeat fixed top right;}

 

3.border 

.div{border-width: 1px;border-style: solid;border-color: #000;}簡寫成.div{border:1px solid #000}

 4.list-style

li{list-style-type:disc;list-style-position:inside;list-style-image:url(‘a.png‘);}簡寫成li{list-style:disc inside url(‘a.png);}

 5.margin padding 

.div{margin-top: 1px;margin-right: 2px;margin-bottom: 3px;margin-left: 4px;}簡寫成.div{margin:1px , 2px ,3px ,4px;//從top 開始的順時針 }
//margin:5px 10px; 上下5px 左右10px
//margin:1px 2px 3px ;上邊距1px 左右2px 下邊距3px
//padding 以此類推

  

 

 

 

  

css 簡寫技巧

聯繫我們

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