I'm stuck trying to align images vertically inside the container divs.
This is my html:
<div class="navbar">
<div class="back">
<img src="http://s16.postimg.org/m5yrst5k1/back_icon.png">
</div>
<div class="title">
<h1>title</h1>
</div>
<div class="menu">
<img src="http://s8.postimg.org/hmusw99pt/menu_icon.png">
</div>
</div>
And this is the css:
html,body{
height: 100%;
width: 100%;
padding:0;
margin:0 auto;
}
.navbar {
background: #09c;
width: 100%;
height: 75px;
z-index: 99999;
box-shadow: 0 0 10px #000;
}
.navbar .back {
position: absolute;
left: 0;
padding:2% 0 0 1%;
}
.navbar .menu{
position: absolute;
right: 0;
padding: 2% 1% 0 0;
}
.navbar .title{
position:absolute;
text-align: center;
width: 100%;
color: white;
}
I know I can use some media-queries to set to top margin so the images are always vertically centered, but there must be a better way to do that.
I also tried something like this with no success:
img{
min-height: 10em;
display: table-cell;
vertical-align: middle;
}
How should I center the images vertically so it is always responsive?
This is my codepen:
http://codepen.io/anon/pen/mLxei
Thanks in advance!