Wrap text around an image on bootstrap 3

后端 未结 6 1147
自闭症患者
自闭症患者 2021-01-11 18:38

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

相关标签:
6条回答
  • 2021-01-11 19:04

    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>
    
    0 讨论(0)
  • 2021-01-11 19:07

    None of these worked for me. My working code using rails 5.2 and bootstrap 4.1:

    <div class="row">
      <div class="col">
        <img src="<%=url_for(@user.image)%>" class="float-left" style="height:150px;margin-right:10px">
           <p>A bunch of text</p>
           <p>More text</p>
      </div>
    </div>
    
    0 讨论(0)
  • 2021-01-11 19:11

    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.

    <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-->
    
    0 讨论(0)
  • 2021-01-11 19:13

    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>
    
    0 讨论(0)
  • 2021-01-11 19:16

    It's far easier to just add a small margin to the image in Adobe Photoshop, then use the img src="img/blog/image.png" class="pull-left The copy flows round the image without you needing to add any styling.

    I just add a 10px white space to the left and bottom of the image.

    0 讨论(0)
  • When using 2 columns the text will never get wrapped around the image.

    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 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

    0 讨论(0)
提交回复
热议问题