below is a multi-columns box that has block-level elements inside it.the box width and height is at it's default value:
above we have:
width
and height
are at their defaults (unset).columns:8 auto;
column-gap:0px;
display
is at default which is block.(inline and inline-block do not work with this layout-mode)column-gap
has no effect here.
notice the flexibility of the small boxes when changing the multi-columns box width to smaller values.hence it is always good to have the containing multi-columns box width
value set to it's max value so that the space between the boxes will not emerge again.
notice that column-count
value is the same as the number of the rendered elements inside the multi-columns box.this number should always be equal to the number of the rendered elements or it's division number withe zero remainder.otherwise the results will be very unexpected.for example:
if we have 8 boxes rendered then i would use:
so the result is a division by zero remainder number.the same is with odd number of boxescolumn-count:8;
-boxes rendered in one row (8 / 8 = 1)column-count: 4;
-boxes rendered in two rows (8 / 4 = 2)column-coumt:2;
-boxes rendered in three rows (8 / 2 = 3)column-count:1
-boxes rendered in eight rows. (8 / 1 = 8)
height
value should be high enough to contain the boxes.otherwise the results are unexpected:
height
value for the multi-columns containing box above is 70px only
column-width
:column-width
is no different than column-count
because column-width
tells the browser: hi..give me one column every 200px for example.the same is happening with column-count
"give me 2 columns in this multi-columns box.