在bootstrap 3上的图像周围换行文本

时间:2022-11-29 11:51:51

I came across an issue with wrapping the text around my image on my column. I have a template that It's running multiple pages. some of the images are not long enough so it wont be able to over the entire column... I realize that they are in 2 different divs but if anyone has a solution to this please let me know.

我遇到了一个问题,即在我的列上将图像包裹在我的图像周围。我有一个模板,它正在运行多个页面。一些图像不够长,所以它不能超过整个列......我意识到它们在2个不同的div中,但如果有人有解决方案请告诉我。

If you read and see what the issue is, you'll see its not a duplicate....

如果您阅读并查看问题所在,您会发现它不是重复的......

here's what my code looks like

这是我的代码的样子

    <div class="row" data-sf-element="Row">
  <div id="contentPlaceholder_C002_Col00" class="sf_colsIn col-md-6" data-sf-element="Column 1">
    <div>
      <div>
        <h2>Contrary to popular belief, Lorem Ipsum is not simply r</h2>
        <p>Contrary to popular belief, Lorem Ipsum is not simply random text. It has roots in a piece of classical Latin literature from 45 BC, making it over 2000 years old. Richard McClintock, a Latin professor at Hampden-Sydney College in Virginia, looked up one of the more obscure Latin words, consectetur, from a Lorem Ipsum passage, and going through the cites of the word in classical literature, discovered the undoubtable source. Lorem Ipsum comes from sections 1.10.32 and 1.10.33 of "de Finibus Bonorum et Malorum" (The Extremes of Good and Evil) by Cicero, written in 45 BC. This book is a treatise on the theory of ethics, very popular during th</p>
        <p>Contrary to popular belief, Lorem Ipsum is not simply random text. It has roots in a piece of classical Latin literature from 45 BC, making it over 2000 years old. Richard McClintock, a Latin professor at Hampden-Sydney College in Virginia, looked up one of the more obscure Latin words, consectetur, from a Lorem Ipsum passage, and going through the cites of the word in classical literature, discovered the undoubtable source. Lorem Ipsum comes from sections 1.10.32 and 1.10.33 of "de Finibus Bonorum et Malorum" (The Extremes of Good and Evil) by Cicero, written in 45 BC. This book is a treatise on the theory of ethics, very popular during th</p>
      </div>
    </div>
  </div>
  <div id="contentPlaceholder_C002_Col01" class="col-md-6" data-sf-element="Column 2"> <img src="/images/default-source/careers/careers_1.jpg?sfvrsn=2" title="careers_1" alt="careers_1"> </div>
</div>

4 个解决方案

#1


10  

When using 2 columns the text will never get wrapped around the image.

使用2列时,文本永远不会缠绕在图像上。

You should put the image and text in one column and give it full with. Then wrap the text and image in a div and float them to the left. Something in the line of this (code is an example and not tested):

您应该将图像和文本放在一列中,然后将其填满。然后将文本和图像包装在div中并将它们浮动到左侧。这一行(代码是一个例子,未经过测试):

<div class="col-md-12">
   <div class="pull-left"><img src="YourImage.png"/></div>
   <div class="pull-left">Your text goes here......</div>
</div>

You might need some margin on the image so the text doesn't stick to close to the image

您可能需要在图像上留出一些余量,以使文本不会贴近图像

#2


5  

This works for me.

这对我有用。

<div class="col-md-12">
<img src="img/image.jpg" class="pull-left">
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Iste molestiae aliquam optio mollitia, unde quas eaque voluptatem dignissimos eos maiores magni reprehenderit nisi, corrupti nemo hic id cum quasi officiis!</p>
</div>

#3


1  

I have 2 columns on this page, each with a text-wrapped image, a title, subtitle, text and link. I nest the image in its own column within the text column to wrap the text. This code converts to full column width when displayed on mobile. I'm sure you could pull-right if you wanted to, but this works for me. See code in action at http://www.lbch.org/_Employment.html.

我在这个页面上有2列,每列都有一个文本包装的图像,标题,副标题,文本和链接。我将图像嵌套在文本列中的自己的列中以包装文本。在移动设备上显示时,此代码将转换为完整列宽。如果你愿意,我相信你可以向右拉,但这对我有用。请参阅http://www.lbch.org/_Employment.html上的代码。

<div class="container">
  <div class="row">
    <div class="col-xs-12">Page Head Title & Text</div>
    <div class="col-xs-12 col-md-6">
      <div class="col-xs-12 col-md-5">
        <img src="image" class="img-responsive" alt=""/> <br> 
      </div>
      <div class="text-left">
        <h4 class="text-center">
            <strong>Article Title</strong><br>
            <small>Article sub-title</small>
        </h4>
        <p>Text</p>
        <p><a href="link">link text</a><strong> </p>
      </div>
    </div>
    <div class="col-xs-12 col-md-6">
      <div class="col-xs-12 col-md-5">
        <img src="image" class="img-responsive" alt=""/> <br> 
      </div>
      <div class="text-left">
        <h4 class="text-center">
          <strong>Article Title</strong><br>
          <small>Article sub-title</small>
        </h4>
        <p>Text</p>
        <p><a href="link">link text</a><strong> </p>
      </div>
    </div>
  </div> <!--row-->
</div> <!--container-->

#4


-2  

But if you want your text and image side by side, Then this would help you.

但如果你想要你的文字和图像,那么这将有助于你。

<div class="row">
<p class="col-md-8">Text goes here....</p>
<img class="img-circle col-md-4" src="image goes here..." alt="image text">
</div>

#1


10  

When using 2 columns the text will never get wrapped around the image.

使用2列时,文本永远不会缠绕在图像上。

You should put the image and text in one column and give it full with. Then wrap the text and image in a div and float them to the left. Something in the line of this (code is an example and not tested):

您应该将图像和文本放在一列中,然后将其填满。然后将文本和图像包装在div中并将它们浮动到左侧。这一行(代码是一个例子,未经过测试):

<div class="col-md-12">
   <div class="pull-left"><img src="YourImage.png"/></div>
   <div class="pull-left">Your text goes here......</div>
</div>

You might need some margin on the image so the text doesn't stick to close to the image

您可能需要在图像上留出一些余量,以使文本不会贴近图像

#2


5  

This works for me.

这对我有用。

<div class="col-md-12">
<img src="img/image.jpg" class="pull-left">
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Iste molestiae aliquam optio mollitia, unde quas eaque voluptatem dignissimos eos maiores magni reprehenderit nisi, corrupti nemo hic id cum quasi officiis!</p>
</div>

#3


1  

I have 2 columns on this page, each with a text-wrapped image, a title, subtitle, text and link. I nest the image in its own column within the text column to wrap the text. This code converts to full column width when displayed on mobile. I'm sure you could pull-right if you wanted to, but this works for me. See code in action at http://www.lbch.org/_Employment.html.

我在这个页面上有2列,每列都有一个文本包装的图像,标题,副标题,文本和链接。我将图像嵌套在文本列中的自己的列中以包装文本。在移动设备上显示时,此代码将转换为完整列宽。如果你愿意,我相信你可以向右拉,但这对我有用。请参阅http://www.lbch.org/_Employment.html上的代码。

<div class="container">
  <div class="row">
    <div class="col-xs-12">Page Head Title & Text</div>
    <div class="col-xs-12 col-md-6">
      <div class="col-xs-12 col-md-5">
        <img src="image" class="img-responsive" alt=""/> <br> 
      </div>
      <div class="text-left">
        <h4 class="text-center">
            <strong>Article Title</strong><br>
            <small>Article sub-title</small>
        </h4>
        <p>Text</p>
        <p><a href="link">link text</a><strong> </p>
      </div>
    </div>
    <div class="col-xs-12 col-md-6">
      <div class="col-xs-12 col-md-5">
        <img src="image" class="img-responsive" alt=""/> <br> 
      </div>
      <div class="text-left">
        <h4 class="text-center">
          <strong>Article Title</strong><br>
          <small>Article sub-title</small>
        </h4>
        <p>Text</p>
        <p><a href="link">link text</a><strong> </p>
      </div>
    </div>
  </div> <!--row-->
</div> <!--container-->

#4


-2  

But if you want your text and image side by side, Then this would help you.

但如果你想要你的文字和图像,那么这将有助于你。

<div class="row">
<p class="col-md-8">Text goes here....</p>
<img class="img-circle col-md-4" src="image goes here..." alt="image text">
</div>