Jump to content

Please can you help confirm my code is correct to Hide a Section on Mobile/Tablet only?

Recommended Posts

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

Hello, I am currently using this code to hide a section so it appears on mobile and tablet only (hidden from Desktop):

 

@media only screen and (min-width:768px) {

[data-section-id="ENTER DATA SECTION ID HERE"] {

   display: none;}}

I am also using this code to hide a section so it appears on desktop only (hidden from Mobile and Tablet):

@media screen and (max-width:991px) {

[data-section-id="5ef4c07482b8e941cd5ebc10"] {

    display: none;

}

}

I am aware however that most tablets and some phones now have higher screen resolution. So is this the best reliable way to do this? Or is there a better code?

My objective, I am trying to have two sets of code:

1 - to hide a section from mobile and tablet so it appears on DESKTOP ONLY

2 - to hide a section from desktop so it appears on MOBILE AND DESKTOP ONLY

 

Please can you help confirm this is ok?

 

Site url = https://bluebird-porcupine-yzdg.squarespace.com/

Pword = bluebird

Many thanks.

Best,

Faiz

 

Link to comment
  • Replies 2
  • Views 341
  • Created
  • Last Reply
1 hour ago, scholarsayze said:

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

Hello, I am currently using this code to hide a section so it appears on mobile and tablet only (hidden from Desktop):

 

@media only screen and (min-width:768px) {

[data-section-id="ENTER DATA SECTION ID HERE"] {

   display: none;}}

I am also using this code to hide a section so it appears on desktop only (hidden from Mobile and Tablet):

@media screen and (max-width:991px) {

[data-section-id="5ef4c07482b8e941cd5ebc10"] {

    display: none;

}

}

I am aware however that most tablets and some phones now have higher screen resolution. So is this the best reliable way to do this? Or is there a better code?

My objective, I am trying to have two sets of code:

1 - to hide a section from mobile and tablet so it appears on DESKTOP ONLY

2 - to hide a section from desktop so it appears on MOBILE AND DESKTOP ONLY

 

Please can you help confirm this is ok?

 

Site url = https://bluebird-porcupine-yzdg.squarespace.com/

Pword = bluebird

Many thanks.

Best,

Faiz

 

Code is fine I think

BeyondSpace - Squarespace Website Developer

🖼️ Lightbox Studio (Enable Pinch/Zoom on lightbox)
🗓️ Delivery Date Picker (Squarespace Date picker form field)
💫 Gallery block 7.1 workaround
🥳 Sparkplugin Customisations Browsers (Browse +100 Spark plugin customisations)
🥳 Elfsight Template Browsers (Browse +1000 Elfsight widget Templates)

If you find my answer useful, let's leave a like or upvote so others with the same issue can find their solution. Thank you!

 

Link to comment

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.