Learn why Gartner just named Builder a Cool Vendor

Announcing Visual Copilot - Figma to production in half the time

Builder.io logo
Contact Sales
Platform
Developers
Contact Sales

Blog

Home

Resources

Blog

Forum

Github

Login

Signup

×

Visual CMS

Drag-and-drop visual editor and headless CMS for any tech stack

Theme Studio for Shopify

Build and optimize your Shopify-hosted storefront, no coding required

Resources

Blog

Get StartedLogin

Use margin and padding to space blocks from each other and change the space between a block's content and border.

An example of margins is the space between tiles on a page. If you don't want the tiles all touching each other, you'd add margins to put some space between them.

An example of padding is making a button wider and taller so that it is easier touch with a fingertip or broad pointer.

Think of padding like the stuffing you put in a pillow to make it bigger. Think of margins as the space between the pillows.

A margin is the space around the outside of a box. The following image features three boxes in a row on a webpage. The space between the boxes is margin.

Screenshot with several boxes styled like tiles or cards on a Builder webpage with arrows pointing to the space between the boxes with a note that says "margin equals space around a box".

To adjust margins, take the following steps:

  1. Select the block that needs margin adjustments.
  2. Go to the Margin & Padding section of the Style tab.
  3. Adjust the values in the outer rectangle to set the margin.

You can use any legal CSS unit for the value, such as percentage, ems, rems, or pixels (px).

The following video demonstrates adjusting the margin settings on a Text block. As the margin values change, the Text block moves further from or closer to the blocks above and below as well as either side.

Padding is the space inside of a box, specifically the space between the content, such as copy, and the border of the box.

The following image features three boxes in a row on a webpage. The space within each box, between the content and the border is padding.

Screenshot with several boxes styled like tiles or cards on a Builder webpage with arrows pointing to the space within the boxes with a note that says "padding equals space inside a box".

To adjust padding:

  1. Select the block that needs padding adjustments.
  2. Go to the Margin & Padding section of the Style tab.
  3. Adjust the values in the inner rectangle to set the padding.

You can use any legal CSS unit for the value, such as percentage, ems, rems, or pixels (px).

The following video demonstrates adjusting the padding settings on a Text block. As the padding values change, the Text block grows or shrinks while its margins–the distance from the top and bottom boxes, as well as either side–remains unchanged.

Margin and padding are best for adding space around and inside of a block. Though sometimes adjusting these settings can make it appear as though the block position is changing, the margin and padding still take up space and affect the flow as the page attempts to adjust to different screen sizes.

Instead, use Alignment settings in the Style tab to significantly adjust the location of an item within its containing block. Reserve margin and padding for basic styling rather than overall layout. By sticking to these guidelines, and leveraging Builder's built-in responsive styles, you'll be able to concentrate more on connecting with your users.

Understanding margin and padding are integral to great layout. For more information on using Builder to create responsive layouts, read Using Columns for Responsiveness, which covers how Builder's built-in Columns block adapts to different screen sizes automatically.


Was this article helpful?

Product

Visual CMS

Theme Studio for Shopify

Sign up

Login

Featured Integrations

React

Angular

Next.js

Gatsby

Get In Touch

Chat With Us

Twitter

Linkedin

Careers

© 2020 Builder.io, Inc.

Security

Privacy Policy

Terms of Service

Newsletter

Get the latest from Builder.io

By submitting, you agree to our Privacy Policy

Product

Platform Overview

Integrations

What's New

Open Source

Builder

Builder

Mitosis

Mitosis

Qwik

Qwik

Partytown

Partytown

Popular Guides

From Design to Code Guide

Composable Commerce Guide

Headless CMS Guide

Headless Commerce Guide

Composable DXP Guide

Design to Code

Resources

Blog

Knowledge Base

Community Forum

Partners

Templates

Success Stories

Showcase

Resource Center

Frameworks

React

React

Next

Next.js

Qwik

Qwik

Gatsby

Gatsby

Angular

Angular

Vue

Vue

Svelte

Svelte

Remix logo

Remix

Nuxt

Nuxt

Hydrogen

Hydrogen

See All

© 2024 Builder.io, Inc.

Security

Privacy Policy

SaaS Terms

Security & Compliance

Cookie Preferences

Gartner Cool Vendor 2024