metafizzy / isotope

:revolving_hearts: Filter & sort magical layouts
https://isotope.metafizzy.co
11.06k stars 1.42k forks source link

Wrong positioning of the grid items if the stamp has a left margin #1428

Open bobamann opened 6 years ago

bobamann commented 6 years ago

Hi

I want to position two stamps in a 100 percent wide grid with 20 percent column wide. If I give the second stamp a left margin, the position of the first grid item is wrong or correct depending on the browser width. Sometimes the left margin is OK with 40% sometimes with 60% not. If you change the browser wide you see whats happend. This only seems to be a problem in Firefox and only occurs when the width of the grid container is not divisible by the number of columns. If the grid container has a width of 1233 pixels, the error is visible.

Test case: https://codepen.io/bobamann/pen/WKOYNL

desandro commented 6 years ago

Thanks for reporting this issue. This is likely related to desandro/masonry#1057, which involves Firefox changing its value with getComputedValue.

bobamann commented 6 years ago

There seem to be rounding errors in firefox. The solution of Khaash to use float:left on the sizer has no effect in this case. I set the width of the grid container to 1233px and the problem is visible. If you change the width to 1235px everything is fine. Test case: https://codepen.io/bobamann/pen/NBvaxj

My solution is to change the width of the container so that it is divisible for firefox by the number of columns. Not elegant but it works. Test case: https://codepen.io/bobamann/pen/zLdEEb

Now the lyrics in the new example are much better ;-)