CSS background-image-size etc

NorseMan

Member
Finally, I found out how to scale background images automatically depending on the viewport/screen size and the screen resolution.

I bought myself a new book about CSS3 and HTML5. But there is a thing missing in the book. It doesn't tell me.....

Ok, I start over. I want to use a different background image on different pages. As I have understood I "Have" to use CSS background-***** in combination with the <body class="******"> tag.

Is this right, or can I use it with a <div> tag too? I mean as a background image in a <div class='****** with width and height 100%" so the <div> covers the screen at all time? Will the CSS background-***** do the same in a <div> as in a <body> tag?

Yes I know i could use a lot of time on this by testing it out my self, but spare me the time by asking in a hope if some of you know the answer.
 
you can use background-* on div, but you may have problem with the height: 100%. To set that, you will need to use flexbox or position absolute/fixed
 
Back
Top