dailyhack icon indicating copy to clipboard operation
dailyhack copied to clipboard

CSS hack for quickly resizing images for mobile devices

Open GraemeFulton opened this issue 5 years ago • 1 comments

Use object-fit cover on your images for a quick way to resize images without ruining proportions...

@media (max-width: 540px) {
    img{
      max-height:200px;
      max-width:100%;
      object-fit:cover; 
    }
}

Here's a demo: https://twitter.com/graeme_fulton/status/1137409649857220608

GraemeFulton avatar Jun 08 '19 17:06 GraemeFulton

Thanks, @GraemeFulton for adding this cool tricks. I love this.

mddanishyusuf avatar Jun 08 '19 18:06 mddanishyusuf