简体   繁体   English

CSS段落不在div周围浮动

[英]css paragraph not floating around div

My float works...kind of..however I'm having a problem when resizing my browser. 我的浮动广告素材...有点..但是我在调​​整浏览器大小时遇到​​问题。 I would like the text to wrap around the div when the screen gets smaller however it's just squishing to the right in a long line of text to the bottom. 我希望文本在屏幕变小时环绕div,但是只是向右挤在一行较长的文本底部。

Here are some pics. 这是一些照片。

This is when it's wider 这是当它更宽时 http://s1280.photobucket.com/user/Jessica_Sears/media/ScreenShot2013-06-05at25048PM_zps64f84fc8.jpg.html

and then this is what it's doing when I resize the browser 然后这就是我调整浏览器大小时的操作

在此处输入图片说明

my html kind of looks like this 我的html看起来像这样

<div class="info">
    <div class="userInfo">
        <p>info here</p>
        <img>
    </div>
    <div class="bio">
        <p>paragraph</p>
        <p>paragraph</p>
        <p>paragraph</p>
    </div>
</div>

and my css looks like this 和我的CSS看起来像这样

.userInfo{
    float: left;
}

.bio p{
    padding-left: 14em;
}

You will have to move your paragraphs inside the same div as the image, and float the actual image. 您将不得不在与图像相同的div内移动段落,并浮动实际图像。 Something like this: http://jsfiddle.net/cLcJu/ 像这样的东西: http : //jsfiddle.net/cLcJu/

As you can see the code is very simple: 如您所见,代码非常简单:

<div class="userInfo">
     <p>some content above the image</p>
     <img src='path_to_image'>
     <p>A bunch of content to the right of and underneath the image</p>
</div>

and the css 和CSS

.userInfo img {
    display: block;
    float: left;
    padding: 10px;    
}

This should work: 这应该工作:

HTML 的HTML

<div class="info">
  <div class="userInfo">
      <p>info here</p>
      <img src="image">
      <p>paragraph</p>
  </div>
</div>

CSS 的CSS

.userInfo img { float: left; }

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM