background-position詳細用法

來源:互聯網
上載者:User

標籤:

1、background-position:0 0;等於background-position:left top;(左上方)

2、background-position:100% 100%;等於background-position:right bottom;(右下角)

3、background-position:-70px -40px;(以左上方為0 0點座標,向左位移70px,向上位移40px)

4、background-position:70px 40px;(以左上方為0 0點座標,向右位移70px,向下位移40px)

5、background-position:50% 50%;等於background-position:center center;(置中顯示)

     background-position:-50% -50%;

     等同於x:-{容器(container)的寬度—背景圖片的寬度}*x百分比,超出的部分隱藏。
     等同於y:-{容器(container)的高度—背景圖片的高度}*y百分比,超出的部分隱藏。

6、說明: 
  設定或檢索對象的背景映像位置。必須先指定 background-image 屬性。
  該屬性定位不受對象的補丁屬性( padding )設定影響。
  預設值為: 0% 0% 。此時背景圖片將被定位於對象不包括補丁( padding )的內容地區的左上方。
  如果只指定了一個值,該值將用於橫座標。縱座標將預設為 50% 。如果指定了兩個值,第二個值將用於縱座標。
  如果設定值為 right center ,因為 right 作為橫座標值將會覆蓋 center 值,所以背景圖片將被居右定位。
  對應的指令碼特性為 backgroundPosition。

background-position詳細用法

聯繫我們

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