19

I want to place 2 pictures, one on top of the page and the other right below it. Then, I want to write something about each picture and I want the text to be located to the right of each picture.

How can this be done?

I am formatting my pictures as following, but the problem is that the pictures are like they were suppose to, but the text appear to be only by first image.

<p style="float: left; clear: left"><img src="image.jpg" height="200px" width="200px" border="1px"></p>
<p>Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text</p>
<p style="float: left; clear: left"><img src="image.jpg" height="200" width="200" border="1px"></p>
<p>Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text</p>
j08691
  • 204,283
  • 31
  • 260
  • 272
HelpNeeder
  • 6,383
  • 24
  • 91
  • 155

2 Answers2

38

Just use some wrapper divs like this:

<div>
    <p style="float: left;"><img src="http://placekitten.com/g/200/200" height="200px" width="200px" border="1px"></p>
    <p>Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text</p>
</div>
<div style="clear: left;">
    <p style="float: left;"><img src="http://placekitten.com/g/200/200" height="200" width="200" border="1px"></p>
    <p>Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text</p>
</div>

jsFiddle example

j08691
  • 204,283
  • 31
  • 260
  • 272
5

A couple things may help:

  1. Your styles don't need to be inline, but I'm assuming you're putting them there for brevity's sake.

  2. The images don't need the wrapping <p>; the styles can be applied to the <img> itself.

  3. It sounds like what you really want is two distinct chunks of content, each with an image and some text. I'd suggest placing the image inside of the <p> element - it's inline, and <p>'s are block. Put the image first, and then float it to the left, as you've tried. That should achieve what you're after.

Kurt Peek
  • 52,165
  • 91
  • 301
  • 526
chipcullen
  • 6,840
  • 1
  • 21
  • 17