html - how to do responsive with css grid and reversed order of elements -


i have html code 2 éléments , invert them on responsive, :

enter image description here

is possible in css or must in js ? (sorry if bad english)

you can use display flex , order this:

<div class="container">    <div>element 1</div>    <div>element 2</div> </div>  .container{    display:flex;    flex-direction: column;  }    .container div:nth-child(1){    order:2;  }   .container div:nth-child(2){    order:1;  }  //change 1024px desktop size target @media (min-width:1024px){   .container div:nth-child(1){    order:1;  }   .container div:nth-child(2){    order:2;  } } 

hope helps