How to create a consistent margin around page content using Groups
In this Bubble.io tutorial video we demonstrate how to achieve a consistent and clean layout with a 20 pixel margin surrounding the inner content of your page in the Bubble editor.
Master Bubble margins: Learn the secret to consistent page layouts with this margins and padding tutorial!
Responsive design made easy: Discover how to create perfect margins that adapt to any screen size using responsive groups.
Unlock the power of Bubble's page structure: See how nesting groups can solve common layout issues and enhance your app's design.
Creating Consistent Margins with Groups
Here's a quick Bubble tip for ensuring that your pages have got nice margins and nice consistent padding around your elements. I've got here a simple header and body content so you can see that my page width is not restricted, there's no fixed width which means that I get my light grey background going full width of the page and that my header is built up of an outer group which is also not set to fixed width and an inner group which is set to a... I've unchecked that and I've checked apply a max width when page is stretched so 100% so that means that the elements inside this group are contained to that max width and I've done the same with my body group here which contains like you can imagine putting charts in here on a dashboard or like a list of contacts.
Adjusting Element Sizes for Uniformity
These are contained also within a group that I've called body that has got a max width and so that way, probably easier to look here, I can adjust the size and it keeps everything central and uniformed. Now there is something a little bit frustrating that happens when I go all the way down I suddenly lose my nice margin which particularly doesn't look good if I have got rounded corners on these elements.
Fixing Margin Issues
So in order to fix that, there's two steps really, I need to put this in another group and then drag this out to the edge of... make sure I've got that parent group... drag this out to the edge. Now you'd think that would work because I've set yet another parameter within the elements on my page to ensure that this 20 pixel gap here remains. But if I go into the responsive engine, it's the old response engine not the new one, you'll see that actually exactly the same thing happens.
Workaround for Consistent Margins
So here's the workaround, my page width is 1240 and I would like there to be a 20 pixel engine on either side to make it look consistent. So I need to add 20 pixels either side so I'm going to add 40 pixels in total to my page width and just drag this all the way across again and center this and do the same with here. So I'm selecting the outer group, you can see I now have a 40 pixel gap down here and by centering this I end up with the 20.
Testing in Responsive Mode
So now if I go back into responsive, you can see that the 20 pixel gap continues no matter how small I make it. And I believe that that is an intentional setup by Bubble that if you create a group and you drag it right to the edge of the screen it behaves as if it's anchored to the edge of the screen.
Ensuring Consistent Gaps
But by forcing there to be this gap, so this is the top of the structure of my page, my page body and I force there to be this 20 pixel gap between the page body and this container here. And once more you can see that it ensures that a 20 pixel gap is carried all the way down to the smallest size.
Ready to Transform Your App Idea into Reality?
Access 3 courses, 400+ tutorials, and a vibrant community to support every step of your app-building journey.
Start building with total confidence
No more delays. With 30+ hours of expert content, you’ll have the insights needed to build effectively.
Find every solution in one place
No more searching across platforms for tutorials. Our bundle has everything you need, with 400+ videos covering every feature and technique.
Dive deep into every detail
Get beyond the basics with comprehensive, in-depth courses & no code tutorials that empower you to create a feature-rich, professional app.
Valued at $80
Valued at $85
Valued at $30
Valued at $110
Valued at $45
14-Day Money-Back Guarantee
We’re confident this bundle will transform your app development journey. But if you’re not satisfied within 14 days, we’ll refund your full investment—no questions asked.
Can't find what you're looking for?
Search our 300+ Bubble tutorial videos. Start learning no code today!
Frequently Asked Questions
Find answers to common questions about our courses, tutorials & content.
Not at all. Our courses are designed for beginners and guide you step-by-step in using Bubble to build powerful web apps—no coding required.
Forever. You’ll get lifetime access, so you can learn at your own pace and revisit materials anytime.
Our supportive community is here to help. Ask questions, get feedback, and learn from fellow no-coders who’ve been where you are now.
Absolutely. If you’re not satisfied within 14 days, just reach out, and we’ll issue a full refund. We stand by the value of our bundle.
Yes, this is a special limited-time offer. The regular price is $350, so take advantage of the discount while it lasts!