SyntaxFix
Write A Post
Hire A Developer
Questions
Depending on what browsers you're targeting, you could go for the object-fit property to solve this:
object-fit: cover;
or maybe fill is what you're looking for. Still under consideration for IE.
fill