html - How to vertically align both image and text side by side in a div -
i have seen answer answer ''vertical align in div " , followed adam's answer. problem how have both image , text side side , text being @ middle of image.
my tried code
css
.outercontainer { display: table; width: 100%; /* width of parent */ height:200px; overflow: hidden; border:1px solid green; } .outercontainer .innercontainer { display: table-cell; vertical-align: middle; width: 100%; margin: 0 auto; }
html
<div class="outercontainer"> <div class="innercontainer"> <div > <img src='http://icons.iconarchive.com/icons/danleech/simple/512/facebook-icon.png' height=50px width=50px> <p style='display:inline-block;font-size:10px;'>some text</p> </div> </div> </div>
my problem 'some text' side , @ middle of image
**note:**i know shouldn't use inline-block here. don't know how it.
the img supposed have vertical align property.
<img src='http://icons.iconarchive.com/icons/danleech/simple/512/facebook-icon.png' height="50" width="50" style="vertical-align:middle;">
Comments
Post a Comment