Sorry if I start from my test case instead of the asked test case, but I am working on a particular website and I found this problem and thought about posting it here in case someone might need this. I am not sure if this is a bug or just a very weird case but I spent 3 hours trying to understand the problem.
I reproduced this on Chromium 66 and Chrome 66.
This does not happen on Edge and Firefox (it works fine with these browsers).
Codepen: https://codepen.io/anon/pen/aGRpbB (open it with Chrome to see one item below the other, open with Firefox or Edge to see them on 4 columns)
Problem: The grid item, in my case it was a UL LI element, with display:table and margin:0 auto; BREAKS the grid on Chrome.
Solution: Apply margin:0 to the grid item (ul li in my case)
What happens: it seems that for some reason, Chrome gives weird margins to the grid items and is unable to declare the correct top and left position of the items.
See this screenshot: https://image.ibb.co/nyWGRJ/test_masonry.png
At the same time, it seems that disabiling the masonry init (eg. remove from the code the masonry() function) will stop the problem on Chrome. So I am not sure if it is a plugin or browser bug, but since I lost so much time trying to figure how to solve this, I hope this can help someone else with my same issue.
If you try to set the margin:0 it should solve the issue on Chrome (at least it does for me)
Fix:
.grid li { margin:0; float:left; width:25%; display:block; display:table; }
Thanks for reporting this issue and for providing a test case 😁. Looks like the simplest solution is to remove display: table from the item elements, and use display: block instead.
Sorry if I start from my test case instead of the asked test case, but I am working on a particular website and I found this problem and thought about posting it here in case someone might need this. I am not sure if this is a bug or just a very weird case but I spent 3 hours trying to understand the problem.
I reproduced this on Chromium 66 and Chrome 66. This does not happen on Edge and Firefox (it works fine with these browsers).
Codepen: https://codepen.io/anon/pen/aGRpbB (open it with Chrome to see one item below the other, open with Firefox or Edge to see them on 4 columns)
Problem: The grid item, in my case it was a UL LI element, with display:table and margin:0 auto; BREAKS the grid on Chrome. Solution: Apply margin:0 to the grid item (ul li in my case) What happens: it seems that for some reason, Chrome gives weird margins to the grid items and is unable to declare the correct top and left position of the items. See this screenshot: https://image.ibb.co/nyWGRJ/test_masonry.png
At the same time, it seems that disabiling the masonry init (eg. remove from the code the masonry() function) will stop the problem on Chrome. So I am not sure if it is a plugin or browser bug, but since I lost so much time trying to figure how to solve this, I hope this can help someone else with my same issue.
If you try to set the margin:0 it should solve the issue on Chrome (at least it does for me) Fix:
.grid li { margin:0; float:left; width:25%; display:block; display:table; }
Test HTML:
Test CSS
Hope this can help, P.S. it's the first time I open an issue so I could have missed something, please be patient, I also tried to made it quickly.