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


#1

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!


#2
  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:


#3

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