DEV Community

nguyenphuongduy124
nguyenphuongduy124

Posted on

CSS Tricks: Fit an Image in a Div

Using object-fit.
Link: https://www.w3schools.com/css/css3_object-fit.asp
Example:
.slider-top {
height: 26rem;
a {
display: block;
height: 100%;
img {
height: 100%;
width: 100%;
object-fit: cover;
}
}
}

Top comments (0)