Spacing and Padding Visualizer

Your workspaceProcessed on your device

Use one to four values in CSS shorthand order. Four values run top, right, bottom and left.

Content
  • Margin
  • Border
  • Padding
  • Content
Content box
136 × 72 px
Border box
174 × 98 px
With margins
210 × 122 px
A few things to know.

Runs in your browser. Width is 16–480 px, height is 16–240 px and each spacing value is a nonnegative whole number from 0–48 px. The preview isolates one box and shows physical sides.

  1. Enter width and height. Use one to four pixel values for margin, padding and border widths.
  2. Compare the colored layers and the content, border and margin-box measurements. Switch Box sizing to see which measurements change.
  3. Copy the CSS or download spacing-box.css. Apply the rule to a box in your layout and check its dimensions.