Jump to content

Disabling custom CSS code injection on mobile view

Go to solution Solved by mattdoherty91,

Recommended Posts

Posted

Site URL: https://cobalt-cinnamon-7xg8.squarespace.com

Hello, I've recently customised my slideshow reel gallery block on my home page using the following styles:

<style>
  .gallery-reel {
  height: clamp(75px, 25vw, 200px) !important;
  padding: 50px 50px !important;
}
</style>

However, I've noticed that on mobile view, this actually hides the gallery altogether! When I remove the code, it all works and looks fine, but obviously the formatting is then wrong on the home page. So... 

Is there a way to either make the above code active only on the desktop view, or (inversely) to make the code disabled on mobile view? I was wondering if the @media-something might be useful?

Any recommendations would be hugely appreciated. Thank you!

  • Replies 1
  • Views 529
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

  • Solution
Posted

Literally moments after submitting this question, I received the answer via a friend:

Wrapping the CSS rule in a "Media Query" would only apply when a screen is larger than 767px (standard breakpoint between mobile and desktop), it would look like this:
<style>
@media(min-width:767px) {
  .gallery-reel {
    height: clamp(75px, 25vw, 200px) !important;
    padding: 17px 0px !important;
  }
}
</style>

I can confirm that this worked perfectly! Shout out to support@will-myers.com 🙌

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.