JSFiddle - React, Tailwind, and code Playground
HTML
<div class="main-box">
<table>
<tr>
<td class="box-title">
<h2>
My title here. :) add some more text
</h2>
</td>
</tr>
<tr>
<td class="box-img">
<img src="//i.imgur.com/NOzWHFF.png" alt="Google">
</td>
</tr>
</table>
</div>
<div class="main-box">
<table>
<tr>
<td class="box-title">
<h2>
My title here. :) add some more text
</h2>
</td>
</tr>
<tr>
<td class="box-img">
<img src="https://upload.wikimedia.org/wikipedia/commons/e/e0/Long_March_2D_launching_VRSS-1.jpg" alt="Google">
</td>
</tr>
</table>
</div>
CSS
*{
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
}
.main-box{
width: 200px;
height: 200px;
border: 2px solid #000;
background-color: #FFF;
position: relative;
}
.main-box table{
width: 100%;
height: 100%;
border-spacing:0;
}
.main-box .box-title{
background-color: rgba(0, 0, 0, 0.1);
height: 1px;
}
.main-box .box-title h2{
margin: 0;
padding: 5px;
font-family: Helvetica, Arial, sans-serif;
}
.main-box .box-img{
text-align: center;
vertical-align: middle;
padding: 5px;
position: relative;
}
.main-box .box-img img{
max-width: 100%;
max-height: 100%;
margin: auto;
position: absolute;
top: 0;
left: 0;
bottom: 0;
right: 0;
}