A responsive grid using css flexbox

By setting flex-flow: row wrap; on the grid container we display the elements inside it as rows that wrap when they are too large for fitting on one line.

Resize your browser window to have some more fun.

Firefox doesn't seem to support the flex-flow property yet, so you'd want to use a polyfill.