Welcome to the Liquify Community

Updated 2 months ago

Styling a section element

I was wondering if styling a section element is possible? If not I would think to put a div inside of the section but with blocks Shopify removes this element and puts the blocks in the section?
J
j
K
8 comments
It depends on what exactly you want to do. So if you have the CSS file and just target the class of the section, then it will work. But if you use a custom attribute or an id, then it won't work, because custom attributes will be removed from the section and id's overwritten
Hi @Kevin, do you have a example on what you want todo? Styling a section is not a problem with css.

If this has been solved i would close the ticket πŸ™‚
Hi Jonas, I have a section with blocks in it. I want the blocks to have padding around them, as an option in the Shopify customiser. But when I do that, the middle has double padding, so I would like to use css grid-gap on the section instead. I have included some screenshots of the design
Attachments
image.png
image.png
Ah understand! Then i would apply it to the block wrapper. And add the settings to the section itself.
For example a li-settings:custom with a number setting:
{ "type": "number", "id": "gap", "label": "Gap", "default": 20 }

and the on the block wrapper element a attribute style="gap: {{section.settings.gap}};"
I thought the block wrapper div would get removed when importing, Ill try it thanks
the html structre stays the same. Does the documentation says that it gets removed?
Did that work ? πŸ™‚
@Kevin do ypu have any more questions on this or should i close this one?
Add a reply
Sign up and join the conversation on Discord