Jump to content

Padding on mobile and Desktop

Recommended Posts

Hey Folks, 

I am trying to make two images on my homepage appear as one image. 'As seen on feature'. 

So that in mobile they stack. 

I have added some custom CSS code to change the padding to -20px on the left and right side of the two images. But then in mobile view the whole padding of screen is out and makes the page bigger than the screen. 

Any ideas how I adjust the left and right padding on desktop and then top and bottom on mobile?

Here is the page - https://www.batchcoffee.co.uk/home-1

Thanks in advance 🙂

Link to comment

Put desktop padding inside this media query:

@media only screen and (min-width:768px) {
  //in here - replace this line//
}

and mobile padding inside here:

@media only screen and (max-width:767px) {
  //in here - replace this line//
}

Note: min-width and max-width will affect desktop and mobile respectively.

You may want to tweak the padding to use 17px instead of 20px (17px is the standard block padding on SQSP)

Please like and upvote if my comments were helpful to you. Cheers!

Zygmunt Spray
Squarespace Website Designer
Contact me: 
https://squarefortytwo.com 
Hire me on Upwork!

🔌 Ghost Squarespace Plugins (Referral link)
📈 SEO Space (Referral link)
 SquareWebsites Plugins (Referral link)
 🔲 SQSP Themes (Referral link) 
Spark Plugin (Referral link) 
 🖼️ Pinch-to-Zoom Gallery Lightbox Plugin (Referral link) 

 Did I help? Buy me a coffee?

Link to comment

It's CSS, same as the padding. Put the lines of custom CSS within the media query. Something like this:

@media only screen and (min-width:768px) {
  #block-yui_3_17_2_1_1666941998979_1830 {
     padding:-17px;
  }
}

If you can provide the padding CSS that you've added I might be able to adjust if for you.

Please like and upvote if my comments were helpful to you. Cheers!

Zygmunt Spray
Squarespace Website Designer
Contact me: 
https://squarefortytwo.com 
Hire me on Upwork!

🔌 Ghost Squarespace Plugins (Referral link)
📈 SEO Space (Referral link)
 SquareWebsites Plugins (Referral link)
 🔲 SQSP Themes (Referral link) 
Spark Plugin (Referral link) 
 🖼️ Pinch-to-Zoom Gallery Lightbox Plugin (Referral link) 

 Did I help? Buy me a coffee?

Link to comment

Topman.

This is what I have so far:

#block-yui_3_17_2_1_1666941010634_110861 
{margin-top:-40px; 
margin-right: -17px; 
margin-bottom:-40px; 
z-index:99;}
#block-yui_3_17_2_1_1666941010634_113072 
{margin-top:-40px; 
margin-left: -17px; 
margin-bottom:-40px; 
z-index:99;}

Link to comment

 

I've split up your Custom CSS to have just the left/right affecting desktop, and the top/bottom just affecting mobile. Hopefully you can see what I've done, and adjust it to work for you. Let me know if this works, give me a thumbs up if it does!

// Desktop
@media only screen and (min-width:768px) {
 #block-yui_3_17_2_1_1666941010634_110861 {
  margin-right: -17px; 
  z-index:99;
 }
 #block-yui_3_17_2_1_1666941010634_113072 {
  margin-left: -17px;  
  z-index:99;
 }
}
// Mobile
@media only screen and (max-width:768px) {
 #block-yui_3_17_2_1_1666941010634_110861 {
  margin-top:-40px; 
  margin-bottom:-40px; 
  z-index:99;
 }
 #block-yui_3_17_2_1_1666941010634_113072 {
  margin-top:-40px;
  margin-bottom:-40px; 
  z-index:99;
 }
}

 

Please like and upvote if my comments were helpful to you. Cheers!

Zygmunt Spray
Squarespace Website Designer
Contact me: 
https://squarefortytwo.com 
Hire me on Upwork!

🔌 Ghost Squarespace Plugins (Referral link)
📈 SEO Space (Referral link)
 SquareWebsites Plugins (Referral link)
 🔲 SQSP Themes (Referral link) 
Spark Plugin (Referral link) 
 🖼️ Pinch-to-Zoom Gallery Lightbox Plugin (Referral link) 

 Did I help? Buy me a coffee?

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.