amitabhaghosh197
5/22/2016 - 5:25 PM

css&HTML importants

css&HTML importants

Position images to center always

Always add a helper class and .helper{ display:inline-block; height:100%;}



<div class="col_featured-image">
 <span class="helper"></span><img src="assets/img/features_tie.png">
</div>
<h1>Tieups</h1>

<style>
 .col_featured-image{
    width: 102px;
    height: 83px;
    margin-left: auto;
    margin-right: auto;
    margin-bottom: 47px;
    overflow:hidden;
}

.col_featured-image > img{
    max-width: 100%;
    max-height: 100%;
    display: inline-block;
    vertical-align: bottom;
    /*position: absolute;
    left: 50%;
    bottom: 0;
    -webkit-transform: translate(-50%, 0);
    -moz-transform: translate(-50%, 0);
    transform: translate(-50%, 0);*/
}

.helper{
    
    display:inline-block;
    height:100%;
    vertical-align:bottom;
}

</style>

Reff:

  1. http://stackoverflow.com/questions/7273338/how-to-vertically-align-an-image-inside-div
  2. http://jsfiddle.net/kizu/4RPFa/4570/