Making a CSS Or Element Responsive on Mobile

By Geoff Griffiths @mmatraining1980

This is what I used to make a container ‘work’ on mobile – it was working fine on desktop, but the text was overlaying the image on mobile:

<style>
  @media screen and (max-width:768px) {
    .name-of-div-container {
      position: relative;
      transform: none;
    }
  }
</style>

On screens that are 768px or less (i.e. mobile phones),
The “name-of-div-container” should be positioned relative with no transform styling.

This is quite specific code for the example I was using but you can replace position relative and transform none with whatever you want the element to do on a mobile device.