vendredi 10 juin 2016

CSS responsive image not staying square


I have an image where the src is loaded dynamically so I don't know the size of it and I also need to keep it responsive so I've set:

.resImg {
  display:block;
  border:5px solid yellow;
  width:100%;
  overflow: hidden;
}

The problem is that I need to maintain the image squared while still in percentages but some images are appearing rectangular.

How can I do this?


Aucun commentaire:

Enregistrer un commentaire