How to center Masonry Items?

前端 未结 1 606
轻奢々
轻奢々 2021-02-20 09:47

I have set up masonry to display items as such:

$(\'#list\').masonry({
  itemSelector: \'.propitem\',
  columnWidth: 230
});

This works, but al

1条回答
  •  梦毁少年i
    2021-02-20 10:17

    You need to use fitWidth (or, in older versions, isFitWidth) along with CSS to make it work. Here's the reference: http://masonry.desandro.com/options.html#isfitwidth

    $('#list').masonry({
      itemSelector: '.propitem',
      columnWidth: 230,
      fitWidth: true
    });
    

    and

    #list {
      margin: 0 auto;
    }
    

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