andreasbm / masonry-layout

An efficient and fast web component that gives you a beautiful masonry layout

Home Page:https://codepen.io/andreasbm/pen/gOOdqVy

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Right-to-left direction

arnoson opened this issue · comments

Is it possible to have a right-to-left order, so that the first item would be in the top right corner?

I just did a quick test and it seems as easy as changing the order via flex-direction: row-reverse and adjusting the margins of the columns.

I struggle with the same rtl issue, and if you want to do it the CSS way with direction: rtl on the body element, it doesn't work on masonry-layout, the left-most column has a wrong margin to its right. However, I figured out that changing
https://github.com/andreasbm/masonry-layout/blob/master/src/lib/masonry-layout.ts#L49
from margin-right to margin-inline-end works perfectly. Can you confirm this? And @andreasbm does it break anything?
https://caniuse.com/?search=margin-inline-end looks good.