Get the App
SLTechnology News&Howtos  ›  Development  › 

How css fits the background image perfectly into the viewport

Shulou Source: shulou.com Published: 2022-06-01 04:37:24 10月02日 Update

This article mainly introduces how css makes the background image perfect for viewports. It is very detailed and has a certain reference value. Friends who are interested must finish reading it.

How to fit the background image perfectly into the viewport

Body {background-image: url ('https://images.unsplash.com/photo-1573480813647-552e9b7b5394?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=2253&q=80'); background-repeat: no-repeat; background-position: center; background-attachment: fixed; background-size: cover;-webkit-background-size: cover;-moz-background-size: cover;-o-background-size: cover;})

Background-attachment sets whether the background image is fixed or scrolled along with the rest of the page.

These are all the contents of the article "how css fits the background image perfectly into the viewports". Thank you for reading! Hope to share the content to help you, more related knowledge, welcome to follow the industry information channel!

Tags: Images backgrounds viewports content articles values interests guys buddies more knowledge industry information information channels parts pages channels references help Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Microsoft Linux vpn OPPO Reno Apple