首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何在右边添加图片,而文字在左边。使用div

如何在右边添加图片,而文字在左边。使用div
EN

Stack Overflow用户
提问于 2021-04-03 06:15:06
回答 1查看 45关注 0票数 0

基本上,我给出了一个div代码,它是我从bootsrap得到的,我试图在div中添加图像,但它似乎不太适合,无论我多少次根据高度和宽度更改图像大小。

正如你在下面的截图中看到的,图片从div的边框上掉了下来。我希望它被整洁地包含起来。因此文本将在左侧,图像将在左侧。

我试过很多次,但都失败了。请来人帮帮我,我是一名大学生,正试图独自解决这一切,但这花费了我大量的时间来修复它,而且它应该在6天内完成!!

代码语言:javascript
复制
<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css" rel="stylesheet" />
<div class="container my-5">
  <div class="row p-4 pb-0 pe-lg-0 pt-lg-5 align-items-center rounded-3 border shadow-lg">
    <div class="col-lg-7 p-3 p-lg-5 pt-lg-3">
      <h1 class="display-4 fw-bold lh-1">Welcome to the Neurodiverse Page!</h1>
      <p class="fs-5 mb-4">Here you will find many information to help be successful in a career in Ai or if your like many of just like learning more about Ai well this place is for you!</p>
      <p class="fs-5 mb-4">This website has been designed to have less clicks! meaning you can scroll through the information you need!</p>
      <p class="fs-5 mb-4">Dont forget to sign up which is at the bottom of this page!</p>
    </div>
  </div>
  <div class="col-lg-4 offset-lg-1 p-0 position-relative overflow-hidden shadow-lg">
    <img class="d-block rounded-lg-3" src="bootstrap-docs.png" alt="">
  </div>
</div>
<div id="my_box">
  <div>
    <img src="https://miro.medium.com/max/1750/1*uQdZlvHn4rb4boX0_VBIVw.jpeg" width="895px" class="img-fluid.img-fluid. max-width: 100%; and height: auto;   alt=" "></div>
</div>
    </div>

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2021-04-03 06:45:20

每一列div都需要在行div中才能获得您想要的内容:

代码语言:javascript
复制
<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css" rel="stylesheet"/>

<div class="container my-5">
    <div class="row p-4 pb-0 pe-lg-0 pt-lg-5 align-items-center rounded-3 border shadow-lg">
        <div class="col-lg-7 p-3 p-lg-5 pt-lg-3">
            <h1 class="display-4 fw-bold lh-1">Welcome to the Neurodiverse Page!</h1>
            <p class="fs-5 mb-4">Here you will find many information to help be successful in a career in Ai or if your like many of just like learning more about Ai well this place is for you!</p>
            <p class="fs-5 mb-4">This website has been designed to have less clicks! meaning you can scroll through the information you need!</p>
            <p class="fs-5 mb-4">Dont forget to sign up which is at the bottom of this page!</p>
        </div>
        <div class="col-lg-4 offset-lg-1 p-0 position-relative overflow-hidden shadow-lg">
            <img src="https://miro.medium.com/max/1750/1*uQdZlvHn4rb4boX0_VBIVw.jpeg" class="img-fluid" alt="">
        </div>
    </div>
</div>

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/66925882

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档