CSS——讀書筆記-04

來源:互聯網
上載者:User

標籤:

第四章 背景映像效果

1.基礎

預設情況下,瀏覽器水平和垂直地重複顯示背景映像,讓映像平鋪在整個頁面上。

body {    background-image:url(/img/pattern.fig);}

可以選擇水平、垂直、不平鋪:repeat-x、repeat-y、no-repeat

body {    background-image: url(/img/pattern.gif);    background-repeat: repeat-x;}

可以設定背圖位置

如: 元素左邊,垂直置中。(也可以使用像素和百分數實現)

h1 {    padding-left: 30px;    background-image: url(/imd/bullet.gif);    background-repeat: no-repeat;    background-position: left center;}

簡寫:

h1 {    background: #ccc url(/img/ddd.gif) no-repeat left center;}

  

2.圓角框

1》固定寬度的圓角框——可以通過背景映像實現圓角

上邊top一個圖、下邊bottom一個圖,中間用背景色串連

靈活的,可寬度擴充的,可以設定4個角各一張圖,然後寬度設定em單位,可根據字型大小展開。

2》多背景、border-radius、border-image

 

3.投影

1》圖片負外邊距位移

2》映像加上邊框和內邊距

3》box-shadow: 

需要4個值:垂直和水平位移、投影的寬度和顏色

 

4.不透明度:

opacity: 0.8

background-color: rgba(0,0,0,0.8)

 

CSS——讀書筆記-04

聯繫我們

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