I am having trouble centering two divs horizontally and aligning them between each other. The issue arises when I add text of different sizes in each div. Here is an example: http://jsfiddle.net/DgEcs/1/
Why does the red div move down and how can this be resolved?
CSS:
.container{
margin: 20px auto;
height: 50px; line-height: 50px;
text-align: center; /* to center red and blue */
background: whiteSmoke;
}
.red{
display:inline-block; /* to put it side by side */
font-size: 10px;
background:red;
}
.blue{
display:inline-block; /* to put it side by side */
font-size: 26px;
background:blue;
}
HTML:
<div class="container" >
<div class="red"> aaaaaaa </div>
<div class="blue"> bbbbbbb </div>
</div>