开发者

How to get this layout?

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 decre开发者_如何学Cased.

alt text http://shup.com/Shup/362173/110511132520-My-Desktop.png


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>


Try

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


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.


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜