Jump to content

Hide sections based on device

Recommended Posts

Posted

Password is 'help' if you need. 

 

So on the test home page. I have created three sections one for standard desktop (browser), one for mobile, and one for tablet. Each area has a hello world browser, mobile or tablet text block. Code is as follows, 

The first two sections work fine but the tablet section at the end does not. Can get the px min and max to work. I think. What am I missing. The tablet is an 2019 apple mini. 

 

  <style>   

   

/*used to hide mobile/tablet when on browser*/   

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

{section[data-section-id="64a8d253e44b923b1fbcd0f9"] /*mobile*/, section[data-section-id="64a974967464c27ad524c7aa"] /*tablet*/   

{display:none}}  

  

/*used to hide browser/tablet when on mobile*/   

@media only screen and (max-width: 640px)     

{section[data-section-id="64a8d1edf9a79a0d49822a7f"] /*Browser*/, section[data-section-id="64a974967464c27ad524c7aa"] /*tablet*/   

{display:none}}      

  

/*used to hide browser/mobile when on tablet*/   

@media only screen and (min-width: 641px) and (max-width: 950px)    

{section[data-section-id="64a8d253e44b923b1fbcd0f9"] /*mobile*/, section[data-section-id="64a8d1edf9a79a0d49822a7f"] /*Browser*/  

{display:none}} 

  

  

</style> 

 

Thank you for your help. 

  • Replies 1
  • Views 413
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

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.