Adjusting Margins, Borders and Padding
Understanding the Box
In HTML, all elements are considered boxes. Â You may even hear people refer to this as the "box model" when reading about design and layout. Â The visual builder makes working with the boxes easy by allowing control over the Margin, Border and Padding settings. Â Before diving in to changing the settings, let's go over what the box model looks like visually.
There are really a few things to understand about the diagram above:
- Padding adds space between the content of the element and the border.
- Background colors/images only cover the Content and Padding areas described above.
- Margin pushes the element away from the surrounding elements on the page helping to create space.
With these simple concepts in mind, you are ready to adjust the way elements look on your page without knowing any HTML or CSS!
Margins
After opening the Element Settings, most elements will contain a Margin, Border and Padding sections. Â Let's cover Margin first. Â The section will look like this:
You can adjust the margin for the top, the sides, or bottom by dragging the slider or by entering a new number into the input field. Â Since the element will adjust in real-time, it's easy to drag the slider around to see what you think looks good. Â
It's also worth noting that all margin values are in pixels.
You might notice that the slider is in the middle even when the value is at zero. Â The visual builder allows for negative margin which is an advanced concept used to pull elements over the top of other elements. Â If you're interested in reading more about negative margin, we'll leave that up to Smashing Magazine's Definitive Guide to Using Negative Margin.
Borders
Borders are a great way to divide two elements on a page visually. Â The border section of the settings looks like this:
You can control which sides the border appears on. Â For example if I'm working with a headline and set the border to the bottom only I can achieve this look:
I can then quickly adjust the Size of the border from the default of 3px to 1px and achieve this look:
There is also a color setting for the border. Â See Changing the Color of Elements for more information on how to adjust colors. Â The final border setting we want to talk about is "Border On". Â Some elements such as headline allow you to move the border from the element to just the Text. Â By changing Border On to "Text" we can achieve the following look.
Padding
The padding settings for an element looks like the screenshot below.
You can control individual padding on the Top, Sides or Bottom using the first three settings. Â Alternatively there is a forth setting labeled "Padding" which gives you a way to set the padding to 5, 10, 15, 20 or 25 pixels on all sides. Â Let's take a look at a headline element with a complete border around it, but no padding.
By changing the Padding setting to 15 pixels, we can quickly achieve this look:
Similar to the Border, we can choose to put the "PADDING ON" only on the text. Â Typically you will only do that if you're also putting the "BORDER ON" to the text as well. Â For fun let's look at what moving the padding and border to the Text instead of the element would look like on this headline.