Get the App
SLTechnology News&Howtos  ›  Development  › 

How css prevents scrolling through the background-attachment property

Shulou Source: shulou.com Published: 2022-06-01 10:47:23 11月18日 Update

Editor to share with you how css through the background-attachment attribute to prevent scrolling, I believe most people do not know much about it, so share this article for your reference, I hope you can learn a lot after reading this article, let's go to know it!

Assuming that the document is longer, then when the document moves down, the backing image will move with it. When the document scrolls beyond the position of the image, the image disappears.

You can prevent this scrolling through the background-attachment attribute. Through this property, you can declare that the image is fixed against the visual area, so it is not affected by movement:

Body {bac kg round-image:url (/ i/eg_bg_02.gif); bac kg round-repeat:no-repeat; bac kg round-attachment:fixed}

If you need to see the effect of the above example, or try it yourself.

The default value of the bac kg round-attachment property is scroll, that is, by default, the scene moves with the document.

The above is all the content of the article "how css prevents scrolling through the background-attachment attribute". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!

Tags: Attributes documents articles content images images not much that is seats backing most settings situations effects more knowledge industry visual area information Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno macOS Shulou Information vpn Huawei MySQL