Skip to main content
CSS Tip

Equal width buttons to the widest one

Make a set of buttons equal in width to the widest one using a few lines of code.

eqaul width buttons

.container {
display: inline grid;
grid-auto-flow: column; /* OR row */
grid-auto-columns: 1fr;
}

See the Pen Equal width buttons by Temani Afif (@t_afif) on CodePen.


More CSS Tips