How to realize fixed background Image with css
This article will explain in detail how to achieve a fixed background image on css. The editor thinks it is very practical, so I share it for you as a reference. I hope you can get something after reading this article.
The code is as follows:
Body {
Background-image:url ("/ test/img/154e.png")
Background-repeat:no-repeat
Background-attachment:fixed
}
Here is a line of text: merry Christmas!
Here is a line of text: merry Christmas!
Here is a line of text: merry Christmas!
Here is a line of text: merry Christmas!
Here is a line of text: merry Christmas!
Here is a line of text: merry Christmas!
The effect is as follows:
Background related attributes:
The background-attachment property sets whether the background image is fixed or scrolled along with the rest of the page. A value of fixed indicates that the background image does not move as the rest of the page scrolls.
The background-repeat property sets whether and how the background image is repeated.
This is the end of this article on "how to achieve a fixed background image in css". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, please share it for more people to see.