PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Friday, September 30, 2022

[FIXED] How to wrap text around image in Bootstrap 5

 September 30, 2022     bootstrap-5, css, html     No comments   

Issue

I want my text to wrap around my image. Right now I'm using the Bootstrap 5 grid system. But this is not giving me the result I want. I've tried using 'float: right' on the image, but that didn't work.

The text should really wrap around the image that is pulled to the right.

How would you achieve this?

My code:

<section id="about" class="about">
      <div class="container">

        <div class="row">
          <div class="col-lg-7 pt-4 pt-lg-0">
            <h3>Over mij</h3>
            <br />
            <p>
              ... text ...
            </p>
          </div>
        
          <div style="text-align: left;" class="col-lg-5">
            <img src="assets/img/fotokristin.jpg" class="img-fluid imgshadow" alt="">
          </div>

        </div>

      </div>
    </section>
    <!-- End About Section -->


Solution

It need s to be in the same .col as the text, before the <p> and use .float-end

<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.1/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-F3w7mX95PdgyTmZZMECAngseQB83DfGTowi0iMjiWaeVhAn4FJkqJByhZMI3AhiU" crossorigin="anonymous">

<section id="about" class="about">
  <div class="container">

    <div class="row">
      <div class="col-lg-7 pt-4 pt-lg-0">
        <h3>Over mij</h3>
        <br />
        <img src="https://via.placeholder.com/100" class="float-end imgshadow" alt="">
        <p>
          Lorem ipsum dolor sit amet, consectetur adipiscing 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>

      <div style="text-align: left;" class="col-lg-5">

      </div>

    </div>

  </div>
</section>



Answered By - Arleigh Hix
Answer Checked By - David Marino (PHPFixing Volunteer)
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing