JSFiddle - React, Tailwind, and code Playground
HTML
<div class="container">
<div class="inner">
<div class="box">
<div class="photo">
<img src="https://en.gravatar.com/userimage/22632911/5cc74047e143f8c15493eff910fc3a51.jpeg"
/>
</div>
<div class="info">
<table>
<tr>
<td>
<div class="username">codefactor</div>
<div class="fullName">Scott McGhee</div>
<div class="title">Lead Engineer</div>
</td>
</tr>
</table>
</div>
<div class="successorList">
<div class="successor">
<img src="https://en.gravatar.com/userimage/22632911/5cc74047e143f8c15493eff910fc3a51.jpeg"
/>
</div>
<div class="successor">
<img src="https://en.gravatar.com/userimage/22632911/5cc74047e143f8c15493eff910fc3a51.jpeg"
/>
</div>
<div class="successor">
<img src="https://en.gravatar.com/userimage/22632911/5cc74047e143f8c15493eff910fc3a51.jpeg"
/>
</div>
<div class="successor">
<img src="https://en.gravatar.com/userimage/22632911/5cc74047e143f8c15493eff910fc3a51.jpeg"
/>
</div>
</div>
</div>
<div class="box">
<div class="photo">
<img src="https://en.gravatar.com/userimage/22632911/5cc74047e143f8c15493eff910fc3a51.jpeg"
/>
</div>
<div class="info">
<table>
<tr>
<td>codefactor</td>
</tr>
</table>
</div>
</div>
<div style="clear:both"></div>
</div>
</div>
CSS
body {
margin: 0;
}
.container {
background-color: black;
width: 100%;
height: 100%;
overflow:hidden;
}
.inner {
background-color: white;
width: 800px;
height: 600px;
-moz-transform-origin: 0 0;
-webkit-transform-origin: 0 0;
-ms-transform-origin: 0 0;
-o-transform-origin: 0 0;
transform-origin: 0 0;
}
.box {
position: relative;
width: 240px;
height: 120px;
overflow: hidden;
border: 1px solid #333;
-moz-border-radius: 3px;
-webkit-border-radius: 3px;
border-radius: 3px;
margin: 10px;
float: left;
-moz-box-shadow: 1px 1px 2px #333;
-webkit-box-shadow: 1px 1px 2px #333;
box-shadow: 1px 1px 2px #333;
}
.info {
margin-left: 60px;
}
.info table {
height: 80px;
width: 180px;
}
.info td {
vertical-align: center;
}
.info .username {
font-size: 20px;
}
.info .fullName, .info .title {
font-size: 12px;
}
.photo {
width: 50px;
height: 50px;
overflow: hidden;
float: left;
}
.photo img {
width: 100%;
}
.successorList {
position: absolute;
bottom: 0;
left: 0;
}
.successor {
width: 40px;
height: 40px;
overflow: hidden;
float: left;
}
.successor img {
width: 100%;
}
JavaScript
(function ($) {
var TRANSFORM;
var $inner = $('.inner');
var $window = $(window);
var iWidth = parseInt($inner.css('width'));
var iHeight = parseInt($inner.css('height'));
var iRatio = iWidth / iHeight;
function getTransformProperty() {
if (!TRANSFORM) {
var el = $inner[0];
var properties = ['transform', 'WebkitTransform', 'msTransform', 'MozTransform', 'OTransform'];
for (var idx = 0; idx < properties.length; idx++) {
var prop = properties[idx];
if (typeof el.style[prop] != 'undefined') {
TRANSFORM = prop;
break;
}
}
TRANSFORM = TRANSFORM || 'transform';
}
return TRANSFORM;
}
function adjustScale() {
$inner.css('display', 'none');
var vWidth = $window.width();
var vHeight = $window.height();
var vRatio = vWidth / vHeight;
var width, height;
if (vRatio > iRatio) {
height = vHeight;
width = vHeight * iRatio;
} else {
width = vWidth;
height = vWidth / iRatio;
}
var scale = width / iWidth;
$inner.css({
marginLeft: (vWidth-width)/2,
marginTop: (vHeight-height)/2,
position: 'static',
display: 'block'
});
$inner[0].style[getTransformProperty()] = 'scale(' + scale + ')';
}
adjustScale();
$window.resize(adjustScale);
})(jQuery);