0

I have a background picture of some random apartment for my website and it looks good on PC and on mobile preview on PC(using Firefox Developer Edition). But when I open it on my iPhone 7 it does not look good, it just shows top left corner of an image.

This is how it looks on my PC: pcimage

And this is how it looks on my iPhone 7:

iphoneimage

This is css for div that has that background image:

#home {
    background: url("../images/seaview/mainpic1.jpg") no-repeat center center fixed;
    display: table;
    height: 100vh;
    position: relative;
    width: 100%;
    background-size: cover;
    text-align: center;
}
mememanyes
  • 115
  • 2
  • 10

1 Answers1

-1

Looks like you are missing a value for background-size and leaving it up to the browser. Just add cover to your CSS rule for the background image:

background: url("../images/seaview/mainpic1.jpg") no-repeat center center cover;

Resource: https://developer.mozilla.org/en-US/docs/Web/CSS/background-size

BugsArePeopleToo
  • 2,976
  • 1
  • 15
  • 16