JSFiddle - React, Tailwind, and code Playground
by junyuecao
HTML
<script src="//cdnjs.cloudflare.com/ajax/libs/holder/2.4.0/holder.js"></script>
<div class="flexTest">
<img src="holder.js/300x200/auto/random"></img>
</div>
<div class="flexTest">
<img src="holder.js/200x300/auto/random"></img>
</div>
<div class="flexTest">
<img src="holder.js/200x200/auto/random"></img>
</div>
<div class="flexTest">
<img src="holder.js/100x100/auto/random"></img>
</div>
CSS
*{box-sizing:border-box;}
.flexTest{
display:flex;
width:200px;
height:200px;
padding:5px;
float: left;
margin-left:20px;
border:1px solid #ddd;
justify-content:center;
align-items:center;
}
.flexTest img{
max-width:100%;
max-height:100%;
width:auto;
height:auto;
}