I'm trying to load an image as a background image as a responsive background image. but the image isn't loading. here is my CSS code. Path of the image is correct

    height: auto;
    width: 100%;
    background-image: url(../img/cover.jpg);

1 Answers

Community On Best Solutions

If the div doesn't has content then its height will be 0px,So the background image is not displayed. Try giving height as 350px say or 100vh . you can check the div height by giving border.Ref this Why doesn't the background image show up without specific width and height? for more details,hope it helps