How to make this layout in CSS?

2019-08-12 19:26发布

This layout

I don't even know how to name it. "Fluid" or "liquid" columns seems to refer to simple dynamic heights. I made this one with and got two questions: is it possible to do it with raw HTML5/CSS3? Is it possible to make it work for 3, 4, ..., n columns?!

2条回答
迷人小祖宗
2楼-- · 2019-08-12 19:37

I understand that you want to achieve something like this
You can use Masonry - which is pure JavaScript & also supports jQuery
or Isotope which is a jQuery Plugin.
Author of these plugins suggests to use Isotope.

查看更多
孤傲高冷的网名
3楼-- · 2019-08-12 19:41

It all depends on how you will set the heights of each read box. If it is content dependent, then it's just a 2 column layout with fluid widths. If you are maintaining a height to width ratio, then you will need to use js to do the math and maintain the height or use an img for the background width:100%; height:auto; display:block and position the content position:absolute: on top of it.

查看更多
登录 后发表回答