views:

25

answers:

1

I have a box with an image and some txt and I want the txt to be horizontal to the image. I know this may be a pretty easy question but I can't seem to find a good answer on the interwebs. thanks for any help.

<div id='container'>
 <img src='someimage.jpg'/>
 <p>some text</p>
</div>
+3  A: 

Take a look at CSS's float property, for example:

<div id='container'>
 <img src='someimage.jpg' style='float: left;'/>
 <p>some text (that will now wrap around the image</p>
</div>
Rowland Shaw
Yeah I've done this but what doesn't make sense to me is the paragraph goes threw the image. Like if I add padding the padding is against the container not the img. Also the margin of the paragraph affects the img and both are pushed away from the top of the container.
creocare
Surely you'd want a margin on the image?
Rowland Shaw
Not in this care. I've been wondering is it bad practice to just set things to postion:"absolute" and then just give them x y cords using top and bottom?
creocare