Jump to content

Change Image Card Block Pic on Mobile

Recommended Posts

Site URL: https://www.patriciaindart.com

Hi there,

I’d like to be able to have a different image when viewing from mobile vs. viewing from desktop.

On the “Offerings” page, the images run long ways vertically. I would like them to run horizontally on mobile. I would prefer if I could substitute the images for completely new images rather than just adjust the ratios.

I’ve included pics of what the images look like on desktop and mobile, and what I would like the images to look like on mobile.

Thanks in advance for your help.

P.

Desktop.png

Current-Mobile.png

Preferred-Mobile.png

Edited by pindart
Link to comment
  • Replies 1
  • Views 379
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Posted Images

2 options to do this

O1. You can add 2 similar image, then we will give the code to show 1 on desktop, show another on mobile

O2. Use CSS to replace current image with new image on mobile. Add this to Design > Custom CSS (This code for first image block, if it works, we will send code for other images)

/* Mobile - Offerings image */
@media screen and (max-width:767px) {
div#block-d14670a6627fd8f1009f img {
    content: url(https://cdn.pixabay.com/photo/2020/04/08/06/55/elephant-5015964__480.jpg);
}
div#block-f48837ed8089c70a3d58 img {
    content: url(https://cdn.pixabay.com/photo/2022/02/19/21/46/beach-7023446__340.jpg);
}
}

 

Email me if you have need any help (free, of course.). Answer within 24 hours. 
Or send to forum message

Contact Customer Care - Learn CSS - Buy me a coffee (thank you!)

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

×
×
  • Create New...

Squarespace Webinars

Free online sessions where you’ll learn the basics and refine your Squarespace skills.

Hire a Designer

Stand out online with the help of an experienced designer or developer.