Latest Post

Background Attachment

How to set a fixed image? Set the image to scroll with the page and always be seen at the top?
How to set the background image in the html page to be in the same position?


Property: Background Attachment

Usage:
background-attachment: scroll;
background-attachment: fixed;

Definition:
 
This tag sets the property of how the background image should behave. Whether it should scroll with the page or be static.
It takes the following values.

a)scroll : The image will scroll with the page
b)fixed : The image will not scroll with the page. It will be static. The content will be moving but not the image

Example 1:

 <body style="background-image: url('earth.jpg'); background-repeat: no-repeat; background-position: center; background-attachment: scroll;"> color name <br><br><br></body>  

Example 2:
 <body style="background-image: url('earth.jpg'); background-repeat: no-repeat; background-position: center; background-attachment: fixed;"> color name <br><br><br></body>