tags:

views:

96

answers:

4

How to get this layout

Green box has float:left, I can do this with fix margin-bottom to image but text amount can be increased or decreased.

alt text

A: 

I'm not sure I understand what you're asking -- are you asking how to ensure the text doesn't wrap to the bottom of the green box?

Just set a margin-left on the text div.

Edit: Oops, major typo.

Nathan Loding
Wouldn't it be margin-left?
Jan Kuboschek
@Jan -- wow, big type, good catch.
Nathan Loding
I gave you your point back ;)
Jan Kuboschek
+1  A: 

Try

<div id="greenbox" style="float: left; width: 100px;"/>
<div id="content" style="margin-left: 100px;"/>
levik
A: 

The easiest way is to give your content float: left; as well.

If that's not possible, then giving it margin-left equal to the width of the green box (plus its margin) will be your best bet.

VoteyDisciple
+1  A: 

http://jsbin.com/uzevu

  #stuff img {
    float:left;
    margin-right:25px;
  }

  #stuff p {
    margin-left:150px;
  }


  <div id="stuff">
    <img src="http://dummyimage.com/125x125/000/fff" />
     <p>
       Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
    </p>
  </div>
luckykind
margin-right on the image does nothing, as far as I can tell. Also, dummy image?!? Odd bird.
ANeves
you're right, margin-right probably isn't needed and can be removed... was inserted on initial testing... but it's not hurting anything either... the dummy image is a placeholder... anything else of little value you want to pick at?
luckykind