使用 CSS 設定背景圖片位置


要設定背景圖片位置,請使用 background-position 屬性。你可以嘗試執行以下程式碼以學習如何使用background-position 屬性

示例

它把背景圖片位置設定為距左側 80 畫素的地方

<html>
   <head>
      <style>
         body {
            background-image: url("/css/images/css.jpg");
            background-position:80px;
         }
      </style>
   </head>
   <body>
      <p>Tutorials point</>
   </body>
</html>

更新日期:2020 年 1 月 30 日

497 次瀏覽

啟動你的 職業

獲得認證,完成課程

開始
廣告
© . All rights reserved.