css - How to vertical center floated div with anchor and image -


i want center images inside div floated. i've tried vertical-align:middle; wasn't success. guess that's because it's floated.

i've created jfiddle problem: https://jsfiddle.net/au0h6u0g/

you may use vertical-align on img , line-height, example:

.top {    height: 150px;    background-color: blue;  }    .container {    float: right;    line-height: 150px;  }    img {    vertical-align: middle;  }
<div class="top">    <div class="container">      <a href="#">        <img src="http://lorempixel.com/400/200/" alt="smiley face" height="50" width="140">      </a>    </div>  </div>

https://jsfiddle.net/au0h6u0g/4/


Comments

Popular posts from this blog

java - Static nested class instance -

c# - Bluetooth LE CanUpdate Characteristic property -

JavaScript - Replace variable from string in all occurrences -