Discuss and resolve questions on Liquid, JavaScript, themes, sales channels, and site speed enhancements.
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
Store URL - https://maisoncreations.com/
What's the best way to change the height in between each section on the main page?
@VinceLegentil if you want to change the height in between sections overall.Add the following code to your base.css class and adjust the height according to your need in between the sections:
<style>
[id^="Shopify-section"] {
margin-bottom: 40px !important; /* Adjust the height here */
}
</style>
but if you want to add this styling only on the home page then you will add the following code including with the javascript code a bit.
document.addEventListener('DOMContentLoaded', function() {
// Check if the current page is the homepage
if (window.location.pathname === '/') {
// Add a class to the body element if it's the homepage
document.body.classList.add('homepage');
}
});
<style>
body.homepage [id^="shopify-section"] {
margin-bottom: 40px !important;/* Adjust the height here */
}
</style>
Hope this helps.Thanks
Thank you for your reply!
Sadly both suggestions are not working. Can you suggest what I'm doing wrong?
Thank you so much for your help!