Home > Back-end >  How to make background image appear bigger on mobile browser
How to make background image appear bigger on mobile browser

Time:07-28

I'm currently trying to make a background image for desktop and mobile. But I don't know how to interpret the different sizes into the webpage. I have a media query set up, but every time I try to input the width: 150% and overflow: hidden it still doesn't seem to fix the problem.

This what it looks like for desktop and this is what mobile looks like. You can see my problem with mobile is that I'm trying to expand the background image/src to make the arcade machine appear bigger/fuller and more centered for a better website design If anyone can help me figure this out, I will try anything.

Heres the HTML and the CSS

CodePudding user response:

add these lines to your images in the CSS

    background-position: center center;
    background-attachment: fixed;
    object-fit: cover;

CodePudding user response:

Try a mediaquery, set the query to change the size of the background to what you want as well as making it centre on the page when the pixels are at a specific resolution

CodePudding user response:

I would suggest loading differently optimized images for desktop and mobile. This will be more performant and easier to style.

CodePudding user response:

If you have a media query set, use it to set the image to a proportion of the viewport width using vw

  • Related