I have a css grid with 3 columns. Each column contains a title and a checkbox. I would like to have the title at the 'true' center of the column, the checkbox at the end of the column. However, the width of the columns might change so I can't statically add a margin to the checkbox.
I have this:
I want this:
I tried to set the checkbox position: absolute
so the text can easily be centered, since the width of the checkbox is ignored. However this would require me to get the width of the column with javascript and programmatically set the margin of the checkbox so it always appears at the end.
Is there a better/css-only way to achieve this?
Minimal example:
<div className="grid grid-cols-3">
<div>
<span>Plannable</span>
<input type="checkbox" />
</div>
<div>
<span>Archive</span>
<input type="checkbox" />
</div>
<div>
<span>Export</span>
<input type="checkbox" />
</div>
</div>