How css fits the background image perfectly into the viewport
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!