CSS Background Attachment

CSS is the language we use to style an HTML document.
CSS describes how HTML elements should be displayed.
This tutorial will teach you CSS from basic to advanced.
Post Reply
Guest

CSS Background Attachment

Post by Guest »

CSS Background Attachment


CSS background-attachment
The background-attachment property specifies
whether the background image should scroll or be fixed (will not scroll with the
rest of the page):

Example
Specify that the background image should be fixed:

body
{
  background-image: url("img_tree.png");
  background-repeat: no-repeat;
  background-position: right top;
  background-attachment: fixed;}

Try it Yourself »


Example
Specify that the background image should scroll with the rest of the page:

body
{
  background-image: url("img_tree.png");
  background-repeat: no-repeat;
  background-position: right top;
  background-attachment: scroll;}

Try it Yourself »


The CSS Background Attachment Property


Property
Description


background-attachment
Sets whether a background image is fixed or scrolls with the rest of the page















+1

Reference: https://www.w3schools.com/css/css_backg ... chment.asp
Post Reply