css屬性深入

來源:互聯網
上載者:User

標籤:

border-width、border-style、border-color這三個邊框屬性一般都簡寫為border屬性:

div{border:1px solid red;}

  border-radius屬性是css三中非常常用的一個屬性,巧妙運用該屬性可以完成很多意想不到的效果。

div{width:0;border-top:100px solid #f00;border-top:100px solid transparent;border-top:100px solid transparent;border-radius:50% 50% 0 0 ;}

  border-image可用圖片作邊框。

  box-shadow可設定盒陰影。

div{width:100px;height:100px;border:1px solid red;box-shadow:10px 10px 12px #f00;}

  line-height可設定行高,注意:該屬性不是設定字型高度。將該屬性的值與元素的高度設為同一個值可讓元素置中,但是只能在一行文本中使用,局限性很大。

p{height:100px;line-height:100px;}

  text-indent設定文本縮排,可代替 

  text-align設定文本水平對齊。

p{text-align:center;}

  letter-spacing設定字元之間的間隔,英文網站上比較常用。

  background-image和background-repeat、background-color、background-position這幾個背景的屬性一般用backgrou簡寫。

div{background:url(#) no-repeat x y red;}

  rgba是比較新的一個顏色標記法,a表示透明度,這在以前只能通過opacity來調整。

  linear-gradient也是css的新屬性,而且相容性不是很好。

body{background-image:linear-gradient(to right,red 50%,blue);}

  

 

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.