Menu Close

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

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.

Posted in CSS