How to put img inline with text
Andrew Mclaughlin
I have this code:
<div class = "content-dir-item"> <p>Text input</p> <img src="./images/email.png" class = "mail" alt="img-mail" />
</div>I would put img inline with text using css. How can I do this?
3 Answers
Images have display: inline by default.
You might want to put the image inside the paragraph.<p><img /></p>
Please make use of the code below to display images inline:
<img style='vertical-align:middle;' src='somefolder/icon.gif'>
<div style='vertical-align:middle; display:inline;'>
Your text here
</div> 1 This should display the image inline:
.content-dir-item img.mail { display: inline-block; *display: inline; /* for older IE */ *zoom: 1; /* for older IE */
}