Fluid Spacing

Learn how to use BreakMade's responsive spacing system that scales fluidly between viewport sizes.

BreakMade’s Fluid Spacing System provides 24 responsive spacing variables (–s1 to –s72) plus 8 section spacing variables (–ss-*) that automatically scale between viewport sizes using CSS clamp(). Say goodbye to media queries for spacing - your layouts adapt smoothly across all screen sizes.

How Fluid Spacing Works

Instead of fixed pixel values, BreakMade spacing uses CSS clamp() to create values that:

  • Have a minimum size (for small screens)
  • Scale fluidly based on viewport width
  • Cap at a maximum size (for large screens)
/* Example: --s32 */
clamp(64px, calc(4rem + ((1vw - 3.6px) * 5.9259)), 128px)

This means:

  • On small screens: 64px
  • On large screens: 128px
  • In between: Scales proportionally

Available Spacing Variables

Standard Spacing (–s1 to –s72)

VariableMinMaxCommon Use
--s14px4pxMicro spacing (fixed)
--s28px8pxTight gaps (fixed)
--s38px12pxExtra small
--s410px16pxSmall padding
--s512px20pxSmall gaps
--s614px24pxElement gaps
--s714px28pxMedium small
--s816px32pxDefault spacing
--s918px36pxMedium gaps
--s1020px40pxComponent padding
--s1224px48pxCard padding
--s1428px56pxMedium padding
--s1632px64pxSection padding (sm)
--s2040px80pxSection padding (md)
--s2448px96pxSection padding (lg)
--s2856px112pxLarge padding
--s3264px128pxHero spacing
--s3672px144pxMajor gaps
--s4080px160pxMajor sections
--s4488px176pxLarge gaps
--s4896px192pxPage sections
--s56112px224pxFeature sections
--s64128px256pxHero sections
--s72144px288pxMaximum spacing

Section Spacing (–ss-*)

For larger layout spacing:

VariableMinMaxUse Case
--ss-none0px0pxNo spacing
--ss-xxs10px20pxMinimal section gap
--ss-xs20px40pxExtra small section gap
--ss-sm32px64pxSmall section gap
--ss-md40px80pxMedium section gap
--ss-lg64px128pxLarge section gap
--ss-xl80px160pxExtra large section gap
--ss-xxl128px256pxMaximum section gap

Using Spacing in Breakdance

In Spacing Fields

Most Breakdance spacing fields accept CSS variables:

  1. Click on a padding, margin, or gap field
  2. Enter the variable: var(--s8)
  3. The spacing applies and scales responsively

Examples

Section Padding:

Top: var(--s32)
Bottom: var(--s32)
Left: var(--s8)
Right: var(--s8)

Element Gap:

Gap: var(--s4)

Card Padding:

Padding: var(--s6)

In Custom CSS

.my-section {
  padding: var(--s24) var(--s8);
}

.my-card {
  padding: var(--s6);
  margin-bottom: var(--s4);
}

.my-grid {
  gap: var(--s6);
}

Spacing Scale Logic

The spacing scale follows a logical progression:

Base-4 Foundation

Most values are multiples of 4:

  • s4 = 4 unit base
  • s8 = 8 units
  • s12 = 12 units
  • s16 = 16 units

Fluid Calculation

Each variable uses this formula:

clamp(minPx, calc(baseRem + ((1vw - 3.6px) * multiplier)), maxPx)

Where:

  • minPx: Minimum value at smallest viewport
  • baseRem: Base rem value for calculation
  • 1vw - 3.6px: Viewport-relative adjustment
  • multiplier: How aggressively it scales
  • maxPx: Maximum value at largest viewport

Common Patterns

Hero Section

.hero {
  padding-top: var(--s64);
  padding-bottom: var(--s48);
}

.hero-content {
  max-width: 800px;
  margin: 0 auto;
}

.hero h1 {
  margin-bottom: var(--s6);
}

.hero p {
  margin-bottom: var(--s8);
}

Card Grid

.card-grid {
  display: grid;
  gap: var(--s6);
  padding: var(--s8);
}

.card {
  padding: var(--s6);
}

.card-title {
  margin-bottom: var(--s2);
}

.card-content {
  margin-bottom: var(--s4);
}

Content Sections

.content-section {
  padding: var(--s32) var(--s8);
}

.content-section + .content-section {
  padding-top: 0;
}

.section-header {
  margin-bottom: var(--s12);
}
.nav {
  padding: var(--s4) var(--s8);
}

.nav-links {
  gap: var(--s6);
}

.nav-link {
  padding: var(--s2) var(--s4);
}

Responsive Design Without Media Queries

The beauty of fluid spacing is eliminating spacing-related media queries:

Traditional Approach (Avoid)

/* Old way - lots of breakpoints */
.section {
  padding: 24px 16px;
}

@media (min-width: 768px) {
  .section {
    padding: 48px 24px;
  }
}

@media (min-width: 1024px) {
  .section {
    padding: 64px 32px;
  }
}
/* New way - one line */
.section {
  padding: var(--s32) var(--s8);
}

The spacing automatically adapts to all viewport sizes!

Choosing the Right Variable

Quick Reference

NeedVariable
Tiny gap--s1 or --s2
Small padding--s4
Default gap--s6 or --s8
Component padding--s8 or --s12
Section padding--s24 or --s32
Hero spacing--s48 or --s64

Rule of Thumb

  • Inline elements: s2-s4
  • Block elements: s4-s8
  • Components: s6-s16
  • Sections: s16-s48
  • Major sections: s32-s72

Combining with Other Features

With Colors

.feature-card {
  padding: var(--s6);
  background: var(--primary-surface);
  border: 1px solid var(--primary-border);
}

With Typography

Typography presets work great with fluid spacing:

.content h2 {
  margin-top: var(--s12);
  margin-bottom: var(--s4);
}

.content p {
  margin-bottom: var(--s4);
}

Best Practices

Consistency

Use spacing variables consistently:

  • Pick 4-5 variables for your project
  • Document your choices
  • Stick to them throughout

Semantic Usage

Choose variables based on purpose, not just size:

  • --s8 for default component gaps
  • --s16 for standard section padding
  • --s32 for major section breaks

Don’t Over-Complicate

You don’t need to use every variable. A typical project might only use:

  • --s2, --s4, --s8, --s16, --s32, --s64

Troubleshooting

Variable Not Working

  1. Ensure BreakMade CSS is enabled
  2. Check for typos in variable name
  3. Verify the field accepts CSS variables
  4. Clear browser cache

Spacing Too Large/Small

The fluid system is designed for typical viewport ranges (360px - 1920px). If your design needs differ:

  1. Use custom CSS with your own clamp() values
  2. Or combine variables: calc(var(--s8) + var(--s4))

Breakdance Field Limitations

Some Breakdance fields may not accept CSS variables. In these cases:

  • Use the Custom CSS panel instead
  • Apply classes with your spacing