Spacing between flexbox items
问题 This is what I want: The closest I've got. Applying margin on flexbox items, then removing half of it from the first & last children. The problem is that :first-child is not always the first visually, because I may alter the layout order (example). Is there a way to take the visual order into account when applying the margin? 回答1: You can try setting the same margin for all the boxes, and then revert this on the container: So replace this: .flex > * { margin: 0 10px; } .flex > :first-child {