Syntax error Which property is used in CSS to control the scrolling of an image in the background?

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



To set the scrolling of an image in the background, use the background-attachment property.

Example

You can try to run the following code to learn how to work with the background-attachment property:

<!DOCTYPE html>
<html>
   <head>
      <style>
         body {
            background-image: url('/css/images/css.jpg');
            background-repeat: no-repeat;
            background-attachment: fixed;
            background-attachment:scroll;
         }.
      </style>
   </head>
   <body>
      <p>The background-image is fixed. Try to scroll down the page.</p>
      <p>The background-image is fixed. Try to scroll down the page.</p>
      <p>The background-image is fixed. Try to scroll down the page.</p>
      <p>The background-image is fixed. Try to scroll down the page.</p>
      <p>The background-image is fixed. Try to scroll down the page.</p>
      <p>The background-image is fixed. Try to scroll down the page.</p>
      <p>The background-image is fixed. Try to scroll down the page.</p>
      <p>The background-image is fixed. Try to scroll down the page.</p>
      <p>The background-image is fixed. Try to scroll down the page.</p>
   </body>
</html>
Updated on: 2020-01-30T08:56:27+05:30

846 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements