We're moving the community! Starting July 7, the current community will be read-only for approx. 2 weeks. You can browse content, but posting will be temporarily unavailable. Learn more

How can I zoom out the background image on mobile view?

Solved

How can I zoom out the background image on mobile view?

julianojg
Excursionist
38 5 4

How would i make the background image be zoomed out as it is too zoomed in while on mobile.

 

 

This is what it currently looks like:

unnamed.jpg

 

This is what i am trying to make it look like:

unnamed.jpg

 

This is the code:

{% if template.name == "index"%}

    {% style %}

    body.gradient {
            -webkit-backdrop-filter:  brightness(65%);
            backdrop-filter:  brightness(65%);
            background: url(https://cdn.shopify.com/s/files/1/0795/7001/0410/files/971B9334-9B9E-4FDE-9DF4-900B3ADE9F26.jpg?v=1689684021) !important;
            background-position: center center;
            background-repeat: no-repeat !important;
            background-size: cover !important;
            background-attachment: fixed !important;
        }
       
        .gradient {
            background: rgb(#000000)
        }
       .footer.gradient,
     header-wrapper  {
            background: rgb(#000000)
        }

    {% endstyle %}

{% endif %}  

 

Accepted Solution (1)
julianojg
Excursionist
38 5 4

This is an accepted solution.

{% style %}
      
/* Set initial styles for the entire page */
html, body {
  background:black;
  margin: 0 !important;
  padding: 0 !important;
  width: 100% !important;
  height: 100% !important;
  overflow: auto; /* Prevent scrolling on mobile */
}

/* Apply styles when the device is in vertical orientation */
@media (max-width: 768px) and (orientation: portrait) {
  body {
    overflow: auto; /* Enable scrolling in vertical orientation */
  }
}

/* Apply styles when the device is in horizontal orientation */
@media (max-width: 768px) and (orientation: landscape) {
  body {
    overflow: auto; /* Enable scrolling in horizontal orientation */
  }
}
    

View solution in original post

Replies 3 (3)

dmwwebartisan
Shopify Partner
12384 2560 3749

@julianojg 

Please share your store URL and frontend store password because your shop is password protected

Thanks!

If helpful then please Like and Accept Solution | Email: dmw.webartisan@gmail.com |  Instagram: @dmw.webartisan
PageFly App to customize your pages | The most powerful Shopify page builder app
julianojg
Excursionist
38 5 4

here is a preview link so password is not needed:

 

https://n9cvsykonkg7kovb-79570010410.shopifypreview.com

julianojg
Excursionist
38 5 4

This is an accepted solution.

{% style %}
      
/* Set initial styles for the entire page */
html, body {
  background:black;
  margin: 0 !important;
  padding: 0 !important;
  width: 100% !important;
  height: 100% !important;
  overflow: auto; /* Prevent scrolling on mobile */
}

/* Apply styles when the device is in vertical orientation */
@media (max-width: 768px) and (orientation: portrait) {
  body {
    overflow: auto; /* Enable scrolling in vertical orientation */
  }
}

/* Apply styles when the device is in horizontal orientation */
@media (max-width: 768px) and (orientation: landscape) {
  body {
    overflow: auto; /* Enable scrolling in horizontal orientation */
  }
}