html - CSS - Margins on div -
i trying align vertical text in div here: html:
<div class="div1"> <div class="div11"> <img src="https://pbs.twimg.com/media/brjsq87imaad3zg.png" alt="" width="40px"> </div> <div class="div12"> <a href="">yo</a> </br> <a href="">yo</a> </div> </div>
css:
.div1 { height: 40px; } .div1 div { display: inline-block; } .div12 { padding-top: 5px; }
jsfiddle: http://jsfiddle.net/4mvpg/1/
the height of divs fixed want set padding-top on last div (.div12) move text down bit. when add padding-top box brought down.
why happening , how can fix this? thanks
when use inline-block
, each block acts if text gets alined (by default) on baseline. if increase height of second block, baseline goes down, , first block well.
you can use vertical-align: top
change this.
Comments
Post a Comment