Search code examples
csspositioncss-grid

CSS Grid place items from right to left


I am working on a web application that has a member list. The quantity of member will come dynamically from the server. I want to show each member's info in a grid of four columns. Is it possible to dynamically place each item from right to left using Css Grid?


Solution

  • You should use direction property:

    .container
    {
      display: grid;
      grid-template-columns: 25vw 25vw 25vw 25vw;
      grid-template-rows: 100vh; /* Your number of rows */
      grid-auto-flow: column;
      direction: rtl;
    }