put n-divs next to each others on large screens and one below each others on small screens

前端 未结 3 1096
名媛妹妹
名媛妹妹 2021-01-25 23:21

I am struggling to achieve this efect ;

I would like to put n-divs next to each others if the screen is big enough , and one below each other otherwise , and I would li

3条回答
  •  温柔的废话
    2021-01-25 23:38

    you can use the css media tag to check for screen size but it might not be compatible with old browser

    @media only screen and (max-width: 1023px) {
    }
    
    @media only screen and (min-width: 1024px) {
    }
    

    see CSS media queries for screen sizes

    i'Ve updated your fiddle with this code AFTER the 'normal' styling so it will over write the 'default' display for your class

    @media only screen and (max-width: 300px) {
      .homepage-top-category-container-list{ /*This should be the container*/
      display: block;
      }
    }
    

    https://jsfiddle.net/9atbtj0L/1/

    if you use the zoom in/out of your browser you will see it in action.

    hope this helps

提交回复
热议问题