PricingBlog

Turning Ordered List into a Grid - modifying the iTunes search tool from Day 2 tutorial

  • lucifer811-1265710257099898881

    Lucifer

    1 year ago

    I just finished going through the Day 2 tutorial on making an iTunes search tool, and I really want to make the list into a responsive grid style (i.e. change the number of rows & columns based on screen size). Is there any way to do this with the ol element or do I need to recreate it using a table element?
  • building_stuff-1265715289744478300

    Janis

    1 year ago

    You can manually set a css grid by going to the parent container (in your case the OL element) and go all the way down in the styling tab, then under Custom CSS set display:grid
  • Then you can easily configure the amount of rows and columns with css grid properties and the viewport variable
  • So no need for a table 🙂
  • building_stuff-1265716799778066443

    Janis

    1 year ago

  • lucifer811-1266165105524215818

    Lucifer

    1 year ago

    amazing, thank you, @Janis !
  • lucifer811-1266171229820420249

    Lucifer

    1 year ago

    Hmm, is there anyway to make the table "responsive" to viewport? i.e. switching from desktop to mobile should change a 3x3 grid into 1x9.
  • Use breakpoints
  • building_stuff-1266282883069382678

    Janis

    1 year ago

    @Lucifer You can also use grid auto fill and adjust the minmax values. It's pretty straightforward - just play with the values until it works like you imagined 🙂

    display: grid
    grid-gap: 12px
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr))
    ❤️1
  • building_stuff-1266283135843434547

    Janis

    1 year ago

    If you want even greater control over the amount of columns per viewport width, then take a look at the video Lucas posted above