JSFiddle - React, Tailwind, and code Playground
HTML
<p>
Not Scaled
</p>
<div class="wrap wrap1">
<img alt='sample' src='http://lorempixel.com/500/500/animals/' />
</div>
<p>
Scaled in HTML
</p>
<div class="wrap wrap2">
<img alt='sample' class='img2' src='http://lorempixel.com/500/500/animals/' width='150' height='150' />
</div>
<p>
Scaled in CSS
</p>
<div class="wrap wrap3">
<img alt='sample' class='img3' src='http://lorempixel.com/500/500/animals/' />
</div>
<p>
background-size
</p>
<div class="wrap wrap4">
</div>
CSS
body {
font-family: sans-serif;
font-size: 14px;
}
.wrap {
width: 150px;
height: 150px;
border: 1px solid #ccc;
margin: 10px;
}
.img3 {
width: 100%;
height: 100%;
}
.wrap1 {
overflow: scroll;
}
.wrap4 {
background-color: #fff;
background-image: url('http://lorempixel.com/500/500/animals/');
background-size: contain;
background-repeat: none;
}