HTML & CSS · Junior · Question 30 of 75

What's the simplest way to space flex items evenly without adding space after the last one?

Explanation

gap adds space only between items - nothing extra at the edges. Both flex and grid support it. margin on items leaves an extra gap after the last one (you'd have to remove it with :last-child), and container padding is spacing from the edges, not between items.

Further reading

Problem with a question

HTML & CSS · Junior · question 30

Test yourself

Take the HTML & CSS · Junior quiz: questions and options are shuffled, and you get a review of your mistakes at the end.

Take this quiz