Having trouble trying to align my final items in a grid layout using Tailwind (with React). Basically I want 3 items across and where there are not 3 items remaining, i.e 2 or 1, I want them centered .
I have tried some kind of col span but didn't work as intended.
To better illustrate what I am trying to do I have attached some diagrams
Current Layout:
Desired layout where 2 items left over :
Desired layout where 1 item left over :
<div className="xl:grid grid-cols-3 gap-4">
//cards .map(item)
</div>