Jump to content

Desktop to Mobile Image Replacement

Recommended Posts

Posted (edited)
I'm trying to replace the desktop image with a mobile image on a non-live site that I'm building. I have the desktop image in section 2 and the mobile in section 3. They are set up as gallery blocks, not background images.
 
On the desktop view, the CSS is doing what it is supposed to, but on the Mobile view, both images/sections are still visible. I'm working in classic 7.1
Does anyone have advice?
 
<style>
@media only screen and (max-width: 640px) {
section[data-section-id="62d9a16c9437e42a72be6475"] {
display: none !important;
}
}
@media only screen and (min-width: 641px) {
section[data-section-id="62d9a3197940bf165283c52b"] {
display: none !important;
}
 
</style>
Edited by HDGray
  • Replies 3
  • Views 301
  • Created
  • Last Reply

Top Posters In This Topic

Posted

Second code missing a } symbol. It should be

<style>
@media only screen and (max-width: 640px) {
section[data-section-id="62d9a16c9437e42a72be6475"] {
display: none !important;
}
}
@media only screen and (min-width: 641px) {
section[data-section-id="62d9a3197940bf165283c52b"] {
display: none !important;
}
  }
</style>

 

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!)

Posted
6 hours ago, tuanphan said:

Second code missing a } symbol. It should be

<style>
@media only screen and (max-width: 640px) {
section[data-section-id="62d9a16c9437e42a72be6475"] {
display: none !important;
}
}
@media only screen and (min-width: 641px) {
section[data-section-id="62d9a3197940bf165283c52b"] {
display: none !important;
}
  }
</style>

 

Thank you! Even this isn't working. It's the desktop version that isn't hidden on the mobile version. I've tried it on two different pages and it's still acting the same way. 

Posted
16 hours ago, HDGray said:

Thank you! Even this isn't working. It's the desktop version that isn't hidden on the mobile version. I've tried it on two different pages and it's still acting the same way. 

Can you share page url? We can check easier

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!)

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.