Thank you! Your submission has been received!
Oops! Something went wrong while submitting the form
Padding and margin enable you to add space inside (padding) or outside (margin) of an element's boundary. These properties make it possible to create responsive websites whose content reflows while maintaining consistent spacing.
Here we’ll cover 5 ways to add margin and padding in Webflow:
Want to follow along with this lesson? Fortunately, we created a zip file which contains all the assets used in the project, and we've included that linkright here
Padding and margin can add space or breathing room inside or outside of an element's boundary. Padding creates space on the inside, while margin creates space on the outside.
Let's explore four different aspects of padding and margin: Individual Sides, Complementary Sides, All Sides, and then Negative Margin.
Let's start with Individual Sides. Here's a heading and an image — some paragraphs — not unlike many layouts. But if we select our heading and add some margin, we can eyeball this and click and drag to adjust. And once we get it just right, we can go down and apply that same class to another heading. And what we're getting at with this example is that we don't want to have to set margin (or any other style value) on individual elements. We're using classes to do the work for us. When we change the margin again on this one, it affects our original heading because it has the same class applied.
Let's select this image. And we can adjust the margin here to create more breathing room.
That's Individual Sides.
“Complementary Sides" simply refers to making padding and margin decisions on both sides (top and bottom; left and right...). If we grab this div block and style our class, we can hold option (or alt) and drag to add padding (breathing room on the inside). And it does this on both sides. Same thing on the top and bottom. We can hold option (or alt) and grab the top or bottom and drag to adjust both sides at once.
That's Complementary Sides.
All Sides is an extension of the same concept. If we want to adjust all four sides at once, hold down shift, and grab the padding (or margin) of one side, and the other three will follow suit.
Finally, let's touch on Negative Margin. Here's a simple section with an image. The image has a soft drop shadow, but that's not terribly important to this.
As we already know, we can add bottom margin on the image to push our paragraphs down. But we can also add negative top margin. And as we do this, as we click and drag to adjust, we can see the image overlap the previous section. Negative Margin does exactly what it's intended to and no, it's not a hack. In fact, Negative Margin is widely accepted as valid CSS.
So, we can adjust padding or margin on Individual Sides, Complementary Sides, or All Sides at once. We can even set Negative Margin to achieve many different effects, like overlapping content.
As a quick epilogue, we’ll make a note that although we clicked and dragged to adjust pixel values, we can also type in values for padding and margin at any time. We can just type in the unit, right after the number. And in some cases, we don’t even need to use numbers. Want to horizontally center an element using auto margin on both sides? Here’s the third most satisfying button to press in all of Webflow.
So, padding & margin: a great way to add or remove breathing room, inside or outside of an element’s boundary.
Thanks for the feedback! This will help us improve our content.
Something went wrong while submitting the form. Please contact email@example.com