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.
Get the Complete Bundle for Just $99
Access 3 courses, 390+ 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 390+ 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.
Save over 70%!
Valued at $80
Valued at $85
Valued at $30
Valued at $110
Valued at $45
Can't find what you're looking for?
Search our 300+ Bubble tutorial videos. Start learning no code today!
Have questions?
We have answers!
Find answers to common questions about our membership plans, programs, and more.
We're here to help you launch your no code SaaS. Reach out to the team and we'll double check our vast library for useful content. We'll advise you on how we'd tackle the same problem and there's a good chance we'll record the video to help the wider community.
As a Planet No Code member, you'll receive a discount on our Bubble coaching sessions. Monthly members receive a 10% discount, while Annual members receive a 17.5% discount. To redeem your discount, simply log into your account and book a coaching session through our platform.
Our 8-week intensive mentorship program is designed to provide personalized guidance and support to help you accelerate your startup journey. You'll be matched with a startup expert who will work with you one-on-one to set goals, overcome challenges, and make rapid progress.
To apply for the Mastery Program, simply click the "Request Invitation" button on our pricing page and fill out the application form. Our team will review your application and schedule a call with you to discuss your goals and determine if the program is a good fit for your needs.
We accept all major credit cards, including Visa, Mastercard, American Express, and Discover.
While we don't offer a free trial, we do provide a 14-day money-back guarantee. If you're not completely satisfied with your membership within the first 14 days, simply contact our support team, and we'll issue a full refund.