space-x in Tailwind CSSspace-x-4 have on a container with multiple inline children?space-x.The space-x-4 class adds horizontal space (left and right) of 1rem (4 * 0.25rem) between each child element inside a flex container arranged in a row.
space-y for vertical spacingspace-y-2 adds vertical space of 0.5rem (2 * 0.25rem) between children stacked vertically.
space-x-2 adds horizontal space, space-y-0.5 is invalid, and space-vertical-2 is not a Tailwind class.
space-x and space-yflex flex-wrap space-x-3 space-y-6, what spacing will the children have?<div class="flex flex-wrap space-x-3 space-y-6"> <div>Item 1</div> <div>Item 2</div> <div>Item 3</div> <div>Item 4</div> </div>
The space-x-3 adds 0.75rem horizontal space, space-y-6 adds 1.5rem vertical space between children. The flex-wrap allows children to wrap to new lines, so vertical spacing applies between rows.
space-x spacing in CSS?space-x-4?Tailwind uses the selector > * + * to apply margin-left only to siblings after the first child, ensuring spacing appears between children but not before the first.
space-x and space-yspace-x or space-y for spacing between interactive elements, what accessibility best practice should you follow?Proper spacing ensures interactive elements are easy to target and navigate. Too little space can cause difficulty for keyboard users or those with motor impairments. Avoid hiding elements or removing focusability.