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?
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
Examples
<body style="background-image: url('test3.jpg'); background-repeat: no-repeat; background-position: center; background-attachment: scroll;"> color name <br><br><br></body>
Result:
<body style="background-image: url('test3.jpg'); background-repeat: no-repeat; background-position: center; background-attachment: fixed;"> color name <br><br><br></body>
Result:
with scroll: It the default behaviour. with fixed: The image shown in this page is an example of fixed. Thus we can get the fixed background image.