<div style="position: relative">
<div style="width: 1024px; margin: 0 auto">
<div style="width: 500px; height: 100px; background: blue"> text</div>
</div>
<div style="height: 100px; width: 50%; position: absolute; right: 0; top:0; background: red;">img</div>
</div>
<div data-toggle="left">
content
</div>
$('[data-toggle="left"]').on('click', function(){
$(this).toggleClass('toggle-left');
}
<div class="table">
<div class="table-cell">
<img src="">
</div>
</div>
.table{
display: table;
width: 500px;
height: 500px;
}
.table-cell{
display: table-cell;
vertical-align: middle;
}
.table-cell img{
display: block;
margin: 0 auto;
max-width: 100%;
max-height: 100%;
}