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

更新于:30-Jan-2020

497 次浏览

启动你的职业生涯

通过完成此课程获取认证证明

开始
广告
© . All rights reserved.