如何将文本放在bootstrap中的图像前?

发布于 2025-02-12 12:46:32 字数 976 浏览 0 评论 0原文

因此,我需要使用Bootstrap将文本定位在图像旁边。它应该看起来像: this

我拥有的代码:

<div id="picture">
        <img src="img/preview.jpg">
    </div>
    
    <div id="description">
        <p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. <br> 
        It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. <br> 
        It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.</p>
    </div>
</div>

So I need to position text next to an image using bootstrap. It should look something like:
this

The code I have:

<div id="picture">
        <img src="img/preview.jpg">
    </div>
    
    <div id="description">
        <p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. <br> 
        It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. <br> 
        It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.</p>
    </div>
</div>

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

半窗疏影 2025-02-19 12:46:32
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet" />
<div class="container">
  <div class="row">
    <div class="col-8">
      <img src="https://images.unsplash.com/photo-1656614291920-80ff97b2cf35?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxlZGl0b3JpYWwtZmVlZHw5fHx8ZW58MHx8fHw%3D&auto=format&fit=crop&w=500&q=60" class="img-fluid">
    </div>
    <div class="col-4">
      <p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book.
        <br> It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. <br> It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently
        with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.</p>

    </div>
  </div>
</div>

- 引导程序可在12个网格系统上工作。

  • ``Row'包含12个网格。
  • 我们可以将所有12个网格与col划分。
    对于您的布局,我将其分为图像的col-8col-4文本。
<div class="container">
 <div class="row">
   <div class="col-8">
     <img>
   </div>
   <div class="col-4">
     //content
   </div>
 </div>
</div>

<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet" />
<div class="container">
  <div class="row">
    <div class="col-8">
      <img src="https://images.unsplash.com/photo-1656614291920-80ff97b2cf35?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxlZGl0b3JpYWwtZmVlZHw5fHx8ZW58MHx8fHw%3D&auto=format&fit=crop&w=500&q=60" class="img-fluid">
    </div>
    <div class="col-4">
      <p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book.
        <br> It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. <br> It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently
        with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.</p>

    </div>
  </div>
</div>

-Bootstrap works on 12 grid systems.

  • ```row`` contains 12 grid.
  • we can divide all 12 grid with col.
    for your lay out I have divided it into col-8 for image and col-4 for text.
<div class="container">
 <div class="row">
   <div class="col-8">
     <img>
   </div>
   <div class="col-4">
     //content
   </div>
 </div>
</div>
苏璃陌 2025-02-19 12:46:32

尝试这样的事情

<div class="row">

<img class="col-6"  src="">
<p class="col-6">line one <br> line two</p>

</div>

Try something like this

<div class="row">

<img class="col-6"  src="">
<p class="col-6">line one <br> line two</p>

</div>
愚人国度 2025-02-19 12:46:32

您可以尝试使用Bootstrap的常规布局(12个COLS网格)

<div class="container">
  <div class="row">
    <div class="col-6">
      <img src="" alt="picture"/>
    </div>
    <div class="col-6">
      "content"
    </div>
  </div>
</div>

You can try using bootstrap's conventional layout (12 cols grid)

<div class="container">
  <div class="row">
    <div class="col-6">
      <img src="" alt="picture"/>
    </div>
    <div class="col-6">
      "content"
    </div>
  </div>
</div>
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文