Background image

i need some help understanding background images, I underdtand how to add the image, its the CSS thats getting me.

For example, what would you use to make the background fit the screen on mobile?

Example CSS would be helpful here.

Thank you

It really depends on what image you are using, and how you want to go about doing it.

I chose to use a media query but there are other options as well. All this really depends on what kind of photo it is and the range of sizes you need it to be displayed. A generic photo of a repeating pattern could be easier to approach as the pattern repeats so you don’t have to worry about cropping or placement.

When you are using a photo of an object then you might want to have a few images that are prepared for different viewing sizes.

Anywho. I don’t think the attached is exactly what you are asking for because the approach varies per photo and what you are trying to do. I broke what background properties I did use into their own rules to hopefully make it easier to see what is happening. Of course there is a background shorthand property that can combine all the properties into one. Check out background properties on MDN for a more comphrensive list. I think this is enough to get you going though.