Skip to main content

Space Between

Utilities for controlling the space between child elements.

CSS Property:margin (on children)
Classes:32

Space Between Classes

ClassCSS
space-x-0> :not(:last-child) { margin-inline-end: 0; }
space-x-0.5> :not(:last-child) { margin-inline-end: 0.125rem; }
space-x-1> :not(:last-child) { margin-inline-end: 0.25rem; }
space-x-2> :not(:last-child) { margin-inline-end: 0.5rem; }
space-x-3> :not(:last-child) { margin-inline-end: 0.75rem; }
space-x-4> :not(:last-child) { margin-inline-end: 1rem; }
space-x-5> :not(:last-child) { margin-inline-end: 1.25rem; }
space-x-6> :not(:last-child) { margin-inline-end: 1.5rem; }
space-x-8> :not(:last-child) { margin-inline-end: 2rem; }
space-x-10> :not(:last-child) { margin-inline-end: 2.5rem; }
space-x-12> :not(:last-child) { margin-inline-end: 3rem; }
space-x-16> :not(:last-child) { margin-inline-end: 4rem; }
space-x-px> :not(:last-child) { margin-inline-end: 1px; }
space-x-reverse> :not(:first-child) { margin-inline-start: var(--tw-space-x-reverse); }
space-y-0> :not(:last-child) { margin-bottom: 0; }
space-y-0.5> :not(:last-child) { margin-bottom: 0.125rem; }
space-y-1> :not(:last-child) { margin-bottom: 0.25rem; }
space-y-2> :not(:last-child) { margin-bottom: 0.5rem; }
space-y-3> :not(:last-child) { margin-bottom: 0.75rem; }
space-y-4> :not(:last-child) { margin-bottom: 1rem; }
space-y-5> :not(:last-child) { margin-bottom: 1.25rem; }
space-y-6> :not(:last-child) { margin-bottom: 1.5rem; }
space-y-8> :not(:last-child) { margin-bottom: 2rem; }
space-y-10> :not(:last-child) { margin-bottom: 2.5rem; }
space-y-12> :not(:last-child) { margin-bottom: 3rem; }
space-y-16> :not(:last-child) { margin-bottom: 4rem; }
space-y-px> :not(:last-child) { margin-bottom: 1px; }
space-y-reverse> :not(:first-child) { margin-top: var(--tw-space-y-reverse); }
-space-x-1> :not(:last-child) { margin-inline-end: -0.25rem; }
-space-x-2> :not(:last-child) { margin-inline-end: -0.5rem; }
-space-y-1> :not(:last-child) { margin-bottom: -0.25rem; }
-space-y-2> :not(:last-child) { margin-bottom: -0.5rem; }

Arbitrary Values

You can use arbitrary values with square bracket notation when you need a specific value not included in the default scale.

space-x-[10px]space-y-[1rem]

Responsive Variants

Apply space between utilities at specific breakpoints using responsive prefixes.

BreakpointPrefixExample
640px+sm:sm:space-x-0
768px+md:md:space-x-0
1024px+lg:lg:space-x-0
1280px+xl:xl:space-x-0
1536px+2xl:2xl:space-x-0