Changing the number of cards according to iPad, iPhone screen width


my app displays 2 cards in a row. I want to run the same application in my iPad where I want 4 products to be displayed in a row. I want to detect screen width and decide number of cards in a row programatically. How to implement this idea? Hope I ll get a nice response!

  1. approach
    use media-queries in your css/scss --> and set the width in %
    if screen is <= 768px --> width of the element is 50%, if bigger then 25%

in other cases:


I ll give it a try! thanks for your response :smile: