html - 如何在 Bootstrap 5 中将文字环绕图像

标签 html css bootstrap-5

我希望我的文字环绕我的图像。现在我正在使用 Bootstrap 5 网格系统。但这并没有给我想要的结果。我试过在图像上使用“float: right”,但没有用。

文本应该真正环绕向右拉的图像。

您将如何实现这一目标?

我的代码:

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

最佳答案

需要s在同一个.col作为文本,在 <p> 之前并使用 .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>

关于html - 如何在 Bootstrap 5 中将文字环绕图像,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/69190070/

相关文章:

javascript - 检查元素是否没有带有 jquery 的子元素

jquery - 在模态内部的表中选择值并填充模态外部的表单?

javascript - html中有类似 "load header first and body last"的东西吗?

html - 从右到左开始表格单元格

html - 如何在整个图像上应用蒙版?

html - float 元素的动态高度

jquery - 在 Angular2 组件中创建的 jQueryUI 元素样式

javascript - 选中任何复选框时如何更改 img 类?

html - 如何将 Bootstrap div 彼此对齐,如果有额外的空间在那里扩展

navbar - 如何在 Bootstrap 5 中实现粘性底部导航栏?