Skip to content
Design System
  • Home
  • Settings
  • Styles
  • Layouts
  • Components
  • Scripts
  • Templates
  • Avatars
  • Buttons
  • Forms
  • Forms: errors
  • Forms: validation
  • Hide and show items inclusively
  • Links
  • Lists
  • SVG icons
  • SVG images
  • Tables
  • Typography
  • Utilities
  • Vertical spacing

Vertical spacing

The Stack Sass mixin, is used to create vertical spacing between block-level elements. Although it resides in 20-mixins rather than 30-base in the architecture, it is discussed here along with other styles that are available to all browsers.

As discussed in Every Layout, flow elements require space to physically and conceptually separate them from the elements that come before and after them. Every Layout uses a .stack class to achieve this, based on Heydon Pickering's lobotomised owl.

Chris Burnell took the theory and converted the Stack class into a mixin.

The design system uses its own version of this mixin but allows for specified units of measurement, rather than predefined reference sizes:

// The mixin
@mixin stack($measure: 1em) {

	display: flex;
	flex-direction: column;
	justify-content: flex-start;

	& > * + * {

		margin-top: $measure;

	}

}

// How to use the mixin with a specific measure
// Omit the round brackets and their contents to use the default 1em
blockquote {

	@include stack(1rem);
    
}

Copyright © 2025 W3C - generated 10 Jan 2025, 12:43:28 UTC

Feedback is welcome and can be submitted as a GitHub issue.