JSFiddle - React, Tailwind, and code Playground
by David Storey
HTML
<img id="fill" src="http://placehold.it/350x150"/>
<img id="contain" src="http://placehold.it/350x150"/>
<img id="cover" src="http://placehold.it/350x150"/>
<img id="none" src="http://placehold.it/350x150"/>
<img id="scale-down" src="http://placehold.it/350x150"/>
CSS
img {
width: 200px;
height: 100px;
}
#fill {
-o-object-fit: fill;
object-fit: fill;
}
#contain {
-o-object-fit: contain;
object-fit: contain;
}
#cover {
-o-object-fit: cover;
object-fit: cover;
}
#none {
-o-object-fit: none;
object-fit: none;
}
#scale-down {
-o-object-fit: scale-down;
object-fit: scale-down;
}
JavaScript
<