使用 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.