'How to wrap text around image in Bootstrap 5
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 1:[1]
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/[email protected]/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>
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Arleigh Hix |