Stretch and scale a CSS image in the background - with CSS only

0 votes

I want my background image to enlarge and shrink according to the size of the browser viewport.

On Stack Overflow, I've come across some queries that are useful, such as Stretch and scale CSS background. It functions perfectly, but I want to insert the image using the backdrop rather than the img tag.

In that one, an img tag is used, and we then pay homage to the img tag using CSS.

width:100%; height:100%;

It is true that enlarging a background image in CSS 3 will function fairly well, although that query is a little bit out of date. This first example is one that I tried, but it didn't work out for me.

Is there a decent way to use the background-image declaration for this?

Jul 29, 2022 in CSS by Edureka
• 13,620 points

edited 5 days ago 7 views

No answer to this question. Be the first to respond.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP