I am working with the tailwind grid system and have specified 6 columns for each row. However, if the number of elements is less than 6, I would like it to resize them to 3.
<div className="grid grid-cols-2 md:grid-cols-4 lg:grid-cols-6 grid-flow-row gap-2">
{data.map((d)=><SomeComponent/ d={d}>)}
</div>
Moreover, I want each element to take a width equal to n/k where n is the number of current columns and k is the total columns in each grid row.