Jump to content

Reduce padding between blocks

Go to solution Solved by Guest,

Recommended Posts

Hi,

I have pretty basic knowledge of CSS and have been able to do some tweaking so far, but I can't figure this one out and I've searched all through the forums but no luck:

Is there any way to reduce the padding between blocks? Right now it looks like there's 10px or so space between all blocks (image, text, quote, etc.) and I'd just like to be able to get my elements closer together.

I feel like this should be a simple fix but can't seem to find how to define the command.

Thanks!

Edited by Guest
Link to comment
  • Solution

Hoorah! After hours of searching and finally asking the question, I figured it out! Just sharing for anyone else looking to accomplish this.

The CSS to define the blocks is ".sqs-block". At margin of 0px you get the default so you have to set the margin to negative values. So basically:


.sqs-block {
margin-left: -10px;
margin-right: -10px;
margin-top -10px;
margin-bottom: -10px;
}

NOW...keep in mind you have to do the right AND left (or top and bottom) so one block doesn't force the other to the default position. This will also reduce outside page margin so if you want to keep that wider than the space between boxes you need to increase the page margin in the style editor by the same amount you decreased in your css (i.e. +10 in this example).

Hope it helps!

Link to comment
  • 6 months later...
  • 1 year later...

@Channon, I figured out how this works. Put this code in the Settings>Advanced page. It looks like this :


<style>
 .sqs-block { 
   margin-left: -30px; 
   margin-right: -30px; 
   margin-top -30px; 
   margin-bottom: -30px; 
   } 

< /style>

(Get rid of the space between the "<" and the "/" in the closing "style"). I had to increase the number from -10 to -30 to really notice the difference.

The code that MickeyArdell provided helps if you see a horizontal scroll bar and that goes in the Design>Custom CSS page. It should look like this :


  div { 
   max-width: 100%; 
   overflow-x: hidden; 
 }

Link to comment
  • 2 months later...
  • 3 months later...
Guest iamme123

@socialitestylePlease fix the missing colon after "margin-top" when you get a chance for users that may not notice why the code isn't working when they first paste it in! :)

Link to comment
  • 1 month later...
  • 2 months later...
  • 9 months later...

I created a block with custom html and now I want to apply css to reduce the padding between my blocks. However, since the custom code option isn't like a text editor, I don't now how to add the css code suggested above to my html code on my square space page. Any suggestions?

Link to comment
  • 6 months later...
  • 2 years later...
  • 10 months later...
On 10/7/2014 at 11:29 AM, MickeyArdell said:

Just wanted to follow up on this, if you do do it include the following code:


 

html, body {
   max-width: 100%;
   overflow-x: hidden;
}

 

 

This will prevent the website scrolling horizontally at all.

@mickeyardell what can I do for my site that is experiencing vertical scrolling in the footer, after restricting the margin between blocks? I want the max height to be the same as the instagram and the footer bar. https://www.moonvalleydesign.co/

 

Link to comment
On 6/23/2021 at 12:31 AM, alpalbents said:

@mickeyardell what can I do for my site that is experiencing vertical scrolling in the footer, after restricting the margin between blocks? I want the max height to be the same as the instagram and the footer bar. https://www.moonvalleydesign.co/

 

Hi. Which element?

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

Contact Customer Care - Learn CSS - Buy me a coffee (thank you!)

Link to comment
  • 9 months later...

Captions and space between image and text. sections

To add in customs CSS.
It works for me in case of if you want to reduce space between an image (photo) and a new section (text). Just increase or decrease the margin bottom to -15px 

.sqs-block {
margin-left: 0px;
margin-right: 0px;
margin-top: 0px;
margin-bottom: -15px;
}

and this one for the caption text below the image:

.image-caption-wrapper {
    margin-top: 0 !important;
    padding-top: 0 !important;}

Captura de pantalla 2022-04-11 a las 14.19.11.png

Edited by delmi
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.