0

I'm trying to align some div elements with pure css, but the problem is that those elements can have different heights and widths.

I've already tried to use tables and grid but I can't figure out the right way to do it.

This is the output I want when there are 8 div in the following order

<div style="height: 2;width:2;"></div>
<div style="height: 1;width:2;"></div>
<div style="height: 2;width:2;"></div>
<div style="height: 2;width:3;"></div>
<div style="height: 2;width:2;"></div>
<div style="height: 1;width:3;"></div>
<div style="height: 1;width:2;"></div>
<div style="height: 1;width:4;"></div>

I'm new here so I cant post images, but here is the link for the expected output https://i.stack.imgur.com/xzGm2.jpg . I'm wondering if that is even possible with css3.

[Edit] : I'm looking for Masonry behavior but with pure css and with different width and heights, that's because I want to use this in a IMG to HTML converter project

0 Answers0