We're moving the community! Starting July 7, the current community will be read-only for approx. 2 weeks. You can browse content, but posting will be temporarily unavailable. Learn more

How to remove margins in custom liquid blocks

How to remove margins in custom liquid blocks

FeelBrill
Visitor
1 0 0

Hello. I have several custom liquid block in my theme (Sense 2.0).

 

For some reason certain custom liquid blocks have a margin, while others don't. I tried adding css styles to remove it by targeting the block id#, but this is not fun and actually does not always work.

Does anyone know what causes the margin to be added to certain custom liquid blocks? What would be the best way to handle (remove) them?

 

link: https://feelbrill.lt/

 

Image 26-06-2025 at 16.04.jpg

Replies 4 (4)

Small_Task_Help
Shopify Partner
1144 55 112

Hi,

Hope this will help

- Find file that contains CSS, like base.css, theme.css, or custom.css. and add the css

CSS example

.shopify-block--custom-liquid {
  margin: 0 !important;
  padding: 0 !important;
}
To Get Shopify Experts Help, Click Here or E-mail - hi@ecommercesmalltask.com
About Us - We are Shopify Developers India
At Google My Business - Ecommerce Small Task - Hire Shopify Developers Ahmedabad

suyash1
Shopify Partner
11112 1367 1751

@FeelBrill please open your page in customize settings and check if you can remove the extra section on this page

To build shopify pages use PAGEFLY | Contact me - suyash.patankar@gmail.com

jakeclifford
Shopify Partner
93 18 25

Hi @FeelBrill,

There is an adjacent sibling selector which will apply margin to any .section that follows another .section which includes the custom liquid section. 

You might be able to remove it from base.css and then use the theme editor to add padding to sections instead (If the padding option is in your theme).

Otherwise for every custom liquid section you could add some CSS, as an example. 

#shopify-section-sections--24912919757141__custom_liquid_7FHUbi
 {
        margin-top: 0px !important;
 }

 

Hope that helps,
Jake 


I'm Jake the Shopify Wizard! If helpful Like and Mark as an Accepted Solution
My Blog - Tips and Tricks for Shopify Horizon and AI features Horizon + AI

Struggling to solve an annoying issue? Get Help Fast

tim
Shopify Partner
4812 598 1733

It was already suggested that there is a special CSS rule which adds top margin to every section which immediately follows another section.

You can override this.

 

Paste this into your "Theme settings"=> "Custom CSS"

section[id*=custom_liquid] {
  margin: 0 !important;
}

Or you can add it into your <style> .. </style> in your custom liquid section.

If my post is helpful, hit the thumb up button -- it will help others with similar problem to find a solution.
I can be reached via e-mail tairli@yahoo.com