How do I dynamically create a collage (grid with no gaps) of images, where images have different heights?

前端 未结 2 1319
眼角桃花
眼角桃花 2021-02-15 18:41

I want to display a page of thumbnails. The thumbnails are user uploaded artwork images. Each image has a constrained width, but not a constrained height, this is to show the

相关标签:
2条回答
  • 2021-02-15 18:59

    If you want to do this in css only you have to create divs for every column, and float those columns (but it messes up order of images).

    Alternatively, you can use jquery plugin like this one.

    0 讨论(0)
  • 2021-02-15 19:07

    Not sure how graceful you need your CSS, but a good option none the less. You could use masonry.js to help that.

    http://css-tricks.com/seamless-responsive-photo-grid/

    0 讨论(0)
提交回复
热议问题