Which property is used in CSS to control the position of an image in the background?



To control the position of an image in the background, use the background-position property.

Example

You can try to run the following code to learn how to work with the background-position property. It sets the background image position 30 pixels away from the left side:

<html>
   <head>
      <style>
         body {
            background-image: url("/css/images/css.jpg");
            background-position:30px;
         }
      </style>
   </head>
   <body>
      <p>Tutorials point</>
   </body>
</html>
Updated on: 2020-01-30T08:54:23+05:30

593 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements