HTML Question
- Started
- Last post
- 9 Responses
- welded0
Put the image in the paragraph tag and float it left. You can also try adding 'align="absmiddle"' on the image, but it's not valid XHTML.
- juhls0
Do you have a separate stylesheet?
- acrossthesea0
display: inline
- NoFavorite0
Is the text wrapped in <p>?
- NoFavorite0
The text will still break onto the next line if it's wrapped in a <p>, even if the image is set to 'display: inline'.
You could float both elements left (float:left).
- CygnusZero40
Float:left is what did it. Ive used that before but forgot about it.
- NoFavorite0
<img src="http://www.claytonbailey.com/popgun11h.jpg" style="float:left;" />
<p style="float:left;">Text goes here</p>Don't actually do it inline. Give each element a class and stick it in your stylesheet.
- Stugoo0
what you could do is float the img left if you want the text to wrap other wise float both img and p left and if possible declare a width for the p tag.
they should sit nicely together then.
- lukus_W0
The general idea would be...
<div style="overflow:auto">
<p style="float: left; width: 80%">I'm trying to put an image on the same line as some HTML text, but the problem is the text wont sit on the same line as the image.</p>
<img src="my_image.png" style="float:left; width: 20%;" />
</div>...but remember that inline styles are bad - you should definitely have a separate stylesheet like juhls said.
- .. the 'overflow: auto' is used to clear the floatslukus_W