Set background image as fixed with CSS

CSSWeb DevelopmentFront End Technology

Use the background-attachment property to display the background image as fixed.

Example

You can try to run the following code to implement the background-attachment property −

Live Demo

<!DOCTYPE html>
<html>
   <head>
      <style>
         body {
            background-image: url("https://www.tutorialspoint.com/videotutorials/images/tutor_connect_home.jpg");
            background-repeat: no-repeat;
            background-attachment: fixed;
            background-position: right top;
         }
      </style>
   </head>
   <body>
      <h1>Background Image</h1>
   </body>
</html>
raja
Published on 09-May-2018 12:55:43
Advertisements