Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to put img inline with text

Tags:

html

css

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?

like image 252
Mazzy Avatar asked Feb 08 '12 21:02

Mazzy


People also ask

How do I align text and image on the same line?

Using the float property of CSS will allow you to place an image and text on the same line without breaking the line break. Or Alternatively, you should use the flexbox method of CSS that uses the flex property to make sure that images and lines are aligned in the same line.


1 Answers

Images have display: inline by default.
You might want to put the image inside the paragraph.
<p><img /></p>

like image 70
elclanrs Avatar answered Oct 11 '22 19:10

elclanrs