Skip to content

Instantly share code, notes, and snippets.

@JulaineScott
Created April 13, 2022 03:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save JulaineScott/2cd3bf77652f76e955e515e4e51fb8e2 to your computer and use it in GitHub Desktop.
Save JulaineScott/2cd3bf77652f76e955e515e4e51fb8e2 to your computer and use it in GitHub Desktop.
How to make image fit an item
.container > div > img {
width: 100%;
height: 1005;
object-fit: cover;
}
<div><img src="img/frog.jpg"></div>
@JulaineScott
Copy link
Author

The image will cover its entire container and the browser will crop if needed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment