Setting a background image for your div is easy.

You can do this like:

background-image: url('<link to image'); background-size:cover;background-attachment: fixed;

However, on mobile, this results in not showing the background image, because no height is set. Setting a fixed height will show the background image in the fixed height you set. Often this is not the best solution. You want the image to be the entire height of the div, and that may vary.

You can simply fix this by adding the following code to your div's class


Now the image will take the size of the div it resides in.

Share this page