Jump to content

Make a Web Element appear on mobile view only

Go to solution Solved by tuanphan,

Recommended Posts

Site URL: https://bluebird-porcupine-yzdg.squarespace.com/

Hello, I understand that you can have a web element appear only on desktop and to be hidden on mobile using this code:

@media only screen and (max-width:768px) {
div#block-BLOCK ID HERE>.sqs-block-content:first-child {
   display: none;
}
}

But I want to know if it is possible to show a web element (e.g. an image or text etc) just on mobile and not visible on desktop view? 

Please advise,

Many thanks!

Best,

Faiz

Link to comment
@media only screen and (min-width:769px) {
div#block-BLOCK ID HERE>.sqs-block-content:first-child {
   display: none;
}
}

 

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

How to: Setup Password & Share url Insert Custom CSS - Page Header - Upload Custom Font - Upload File - Find Block ID - Contact Customer Care

Link to comment

OK yes that's great! I'm trying to learn the code rather than just copying + pasting so thank you!

Should I change this code then to:

@media only screen and (min-width:768px) {
div#block-BLOCK ID HERE>.sqs-block-content:first-child {
   display: none;
}
}

what about the code to hide on mobile device, should this stay the same as here?

@media only screen and (max-width:768px) {
div#block-BLOCK ID HERE>.sqs-block-content:first-child {
   display: none;
}
}

Link to comment
5 hours ago, scholarsayze said:

Sorry, just to add on here, as well as removing an element in mobile view, is it possible to remove an entire section so it doesn't appear on mobile view?

Which template do you use? or which SS version: 7.0 or 7.1?

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

How to: Setup Password & Share url Insert Custom CSS - Page Header - Upload Custom Font - Upload File - Find Block ID - Contact Customer Care

Link to comment
On 6/10/2020 at 11:22 AM, scholarsayze said:

Sorry, just to add on here, as well as removing an element in mobile view, is it possible to remove an entire section so it doesn't appear on mobile view?

@scholarsayze yes it's possible to remove entire sections using CSS and media queries. 

Philadelphia, PA

👉 Squarespace Tutorials 

Chat/Message on FB Messenger for quickest responsehttps://m.me/dejaegherryan

 

Link to comment
  • Solution
18 hours ago, scholarsayze said:

Thanks Tuanphan I it's v7.1

@media screen and (max-width:767px) {
[data-section-id="abcxyztuan"] {
	display: none;
}
}

Find ID with this tool https://chrome.google.com/webstore/detail/squarespace-id-finder/igjamfnifnkmecjidfbdipieoaeghcff

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

How to: Setup Password & Share url Insert Custom CSS - Page Header - Upload Custom Font - Upload File - Find Block ID - Contact Customer Care

Link to comment
  • 1 year later...
18 hours ago, meganntab said:

I followed the steps on this and, it worked, but I have a bunch of extra padding beneath the section I removed on the mobile version. Desktop version looks fine. Is there a way to fix this? 

Link: https://www.nationaltab.com/solutions

Hi. Target data-section-id, don't target block id.

Use this tool to find data section id. https://chrome.google.com/webstore/detail/squarespace-id-finder/igjamfnifnkmecjidfbdipieoaeghcff?hl=en

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

How to: Setup Password & Share url Insert Custom CSS - Page Header - Upload Custom Font - Upload File - Find Block ID - Contact Customer Care

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.