Categories
CSS

How to stretch and scale a CSS image in the background with CSS?

Spread the love

Sometimes, we want to stretch and scale a CSS image in the background with CSS

In this article, we’ll look at how to stretch and scale a CSS image in the background with CSS.

How to stretch and scale a CSS image in the background with CSS?

To stretch and scale a CSS image in the background with CSS, we set the background-size property.

For instance, we write

div {
  background-size: cover;
}

to set background-size to cover to make the background image stretch and scale.

Conclusion

To stretch and scale a CSS image in the background with CSS, we set the background-size property.

By John Au-Yeung

Web developer specializing in React, Vue, and front end development.

Leave a Reply

Your email address will not be published. Required fields are marked *