То, что вы хотите, может быть достигнуто тремя способами: CSS мудрый:
.parent {
display: flex;
flex-direction: column;
flex-wrap: wrap;
max-width: {max-width-of-container} /* normally 100%, in a relative container */
min-height: {min-height-of-container}; /* i'd use vh here */
}
.child {
width: {column-width};
display: block;
}
(это решение имеет очень четкое преимущество встроенного column-span
- довольно удобно для названий). Недостатком является упорядочивание элементов в столбцах (первый столбец содержит первую треть элементов и т. Д.). Для этого я сделал jsFiddle .
.parent {
-webkit-columns: {column width} {number of columns}; /* Chrome, Safari, Opera */
-moz-columns: {column width} {number of columns}; /* Firefox */
columns: {column width} {number of columns};
}
.child {
width: {column width};
}
/* where {column width} is usually fixed size
* and {number of columns} is the maximum number of columns.
* Additionally, to avoid breaks inside your elements, you want to add:
*/
.child {
display: inline-block;
-webkit-column-break-inside: avoid;
page-break-inside: avoid;
break-inside: avoid-column;
}
абсолютное позиционирование после вычисления размеров сделанных элементов, через JavaScript (плацдарм кладки).