JSFiddle - React, Tailwind, and code Playground
HTML
<div class="holder">
<div id="frame">
<img src="http://jsfiddle.net/img/logo.png" class="centerme"/>
</div>
</div>
CSS
.holder{height:300px; width:500px; background:red; display:block;}
#frame{ height:200px; width:212px; background:blue; margin:20px; display:block; overflow:hidden;}
#frame img { width:290px; border:2px solid green; }
JavaScript
$(function(){
var fwidth = $('#frame').width();
var iwidth = $('#frame img').width();
$('#frame img').css('margin-left', Math.floor((fwidth-iwidth)/2)-3);
//alert(fwidth+' / '+ iwidth );
});