How can I set a max-width for an image on desktop view only?

Solved

How can I set a max-width for an image on desktop view only?

hezrez94
Tourist
5 0 4

I have a single image in a collage section on my home page. Looks great on mobile but on desktop it stretches the image too much. I want to set max-width on desktop to 1080px. How can I do this? Thanks!

Accepted Solution (1)
Made4uo-Ribe
Shopify Partner
7609 1833 2245

This is an accepted solution.

Thanks for the info, check this one. 

From your Shopify admin dashboard, click on "Online Store" and then "Themes".

Find the theme that you want to edit and click on "Actions" and then "Edit code".

In the "Assets" folder, click on "base.css, style.css or theme.css" file, depending on which file your theme uses to store its CSS styles. At the bottom of the file, add the following CSS code:

 

@media only screen and (min-width: 749px){
section#shopify-section-template--15106090172505__18041cef-18e6-472f-8a53-e51df3630df8 .media.media--transparent.ratio {
    max-width: 1080px !important;
}
.page-width.section-template--15106090172505__18041cef-18e6-472f-8a53-e51df3630df8-padding {
    width: 1080px !important;
}
}

 

And Save. 

Result:

Made4uoRibe_0-1702084946074.png

 

 

Please don't forget to Like and Mark Solution to the post that helped you. Thanks!

If this fixed your issue Likes and Accept as Solution is highly appreciated. Coffee tips fuels my dedication.
Get EXPERIENCED Shopify developers at affordable rates—visit Made4Uo.com for quick quote!
Do not lost your Shopify store! Get FREE trial with ✔️ Rewind Backup: Automatic, reliable, stress-free.
Need THEME UPDATES but has custom codes? No worries, contact us for affordable price.

View solution in original post

Replies 4 (4)

Made4uo-Ribe
Shopify Partner
7609 1833 2245

Hi @hezrez94 

Is this for banner only? You can also edit your image into 2000px so it wont be blur or stretched the image. And to set the max-width, please share your store URL. Thanks!

If this fixed your issue Likes and Accept as Solution is highly appreciated. Coffee tips fuels my dedication.
Get EXPERIENCED Shopify developers at affordable rates—visit Made4Uo.com for quick quote!
Do not lost your Shopify store! Get FREE trial with ✔️ Rewind Backup: Automatic, reliable, stress-free.
Need THEME UPDATES but has custom codes? No worries, contact us for affordable price.
hezrez94
Tourist
5 0 4

I'm using a single image collage, I don't want it to stretch across like a banner.

Store is https://rejoover.co.nz and the image I'm trying to fix is the one that says "I feel 20 years younger", near bottom of page. Thanks for your assistance

Made4uo-Ribe
Shopify Partner
7609 1833 2245

This is an accepted solution.

Thanks for the info, check this one. 

From your Shopify admin dashboard, click on "Online Store" and then "Themes".

Find the theme that you want to edit and click on "Actions" and then "Edit code".

In the "Assets" folder, click on "base.css, style.css or theme.css" file, depending on which file your theme uses to store its CSS styles. At the bottom of the file, add the following CSS code:

 

@media only screen and (min-width: 749px){
section#shopify-section-template--15106090172505__18041cef-18e6-472f-8a53-e51df3630df8 .media.media--transparent.ratio {
    max-width: 1080px !important;
}
.page-width.section-template--15106090172505__18041cef-18e6-472f-8a53-e51df3630df8-padding {
    width: 1080px !important;
}
}

 

And Save. 

Result:

Made4uoRibe_0-1702084946074.png

 

 

Please don't forget to Like and Mark Solution to the post that helped you. Thanks!

If this fixed your issue Likes and Accept as Solution is highly appreciated. Coffee tips fuels my dedication.
Get EXPERIENCED Shopify developers at affordable rates—visit Made4Uo.com for quick quote!
Do not lost your Shopify store! Get FREE trial with ✔️ Rewind Backup: Automatic, reliable, stress-free.
Need THEME UPDATES but has custom codes? No worries, contact us for affordable price.
hezrez94
Tourist
5 0 4

Amazing. It worked perfectly. Thank you!!