How to “crop” a rectangular image into a square with CSS?

A pure CSS solution with no wrapper div or other useless code:

img {
  object-fit: cover;
  width: 230px;
  height: 230px;
}

Leave a Comment