Bootstrap 4 个文本环绕另一个 column/images
Bootstrap 4 text wrapping around another column/images
嗨,我有一个问题,我的文字没有用 bootstrap 环绕我的图像 4. 它不是环绕在右边,也许我不应该把图像放在单独的列中?
两个图像必须在彼此的顶部,但我需要文本在它的右侧,当屏幕变小并且文本高度大于它需要的两个图像的高度时环绕它们。
另外,我怎样才能使图像在您调整浏览器大小时不调整大小,以便它们始终保持相同大小。
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">
<script src="https://code.jquery.com/jquery-3.2.1.slim.min.js" integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js" integrity="sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q" crossorigin="anonymous"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js" integrity="sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl" crossorigin="anonymous"></script>
<section id="about">
<div class="container">
<div class="row">
<div class="col-lg-6 col-md-12 col-sm-12">
<h1>About</h1>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit.
Illo suscipit facilis ipsum ullam reiciendis odio error
iste neque ratione libero rem accusamus voluptatibus, nihil
unde maiores sunt nisi. Assumenda, consectetur.
</p>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit.
Illo suscipit facilis ipsum ullam reiciendis odio error
iste neque ratione libero rem accusamus voluptatibus, nihil
unde maiores sunt nisi. Assumenda, consectetur.
</p>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit.
Illo suscipit facilis ipsum ullam reiciendis odio error
iste neque ratione libero rem accusamus voluptatibus, nihil
unde maiores sunt nisi. Assumenda, consectetur.
</p>
</div>
<div class="col-lg-6 col-md-12 col-sm-12">
<div class="row">
<div class="col-12">
<h1>About</h1>
</div>
<div class="col-6">
<div class="row">
<div class="col-12">
<img src="http://via.placeholder.com/350x150" alt="" style="width: 100%;
margin-bottom: 25px;" class="about-img">
</div>
<div class="col-12">
<img src="http://via.placeholder.com/350x150" alt="" style="width: 100%;
margin-bottom: 25px;" class="about-img">
</div>
</div>
</div>
<div class="col-6">
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit.
Illo suscipit facilis ipsum ullam reiciendis odio error
iste neque ratione libero rem accusamus voluptatibus, nihil
unde maiores sunt nisi. Assumenda, consectetur.
</p>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit.
Illo suscipit facilis ipsum ullam reiciendis odio error
iste neque ratione libero rem accusamus voluptatibus, nihil
unde maiores sunt nisi. Assumenda, consectetur.
</p>
</div>
</div>
</div>
</div>
</div>
</section>
你应该把图片和文字放在同一个col
。在图片上使用 float-left
,让文字环绕它们。
https://www.codeply.com/go/GNkJjFkPfP
<div class="row">
<div class="col-12 mb-3">
<img src="http://via.placeholder.com/350x150" class="float-left mr-3 about-img">
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit.
Illo suscipit facilis ipsum ullam reiciendis odio error
iste neque ratione libero rem accusamus voluptatibus, nihil
unde maiores sunt nisi. Assumenda, consectetur.
</p>
</div>
<div class="col-12 mb-3">
<img src="http://via.placeholder.com/350x150" class="float-left mr-3 about-img">
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit.
Illo suscipit facilis ipsum ullam reiciendis odio error
iste neque ratione libero rem accusamus voluptatibus, nihil
unde maiores sunt nisi. Assumenda, consectetur.
</p>
</div>
</div>
看起来您还有很多不必要的 row>col 嵌套。如果您不想调整图像大小,请删除 width:100%
。
嗨,我有一个问题,我的文字没有用 bootstrap 环绕我的图像 4. 它不是环绕在右边,也许我不应该把图像放在单独的列中?
两个图像必须在彼此的顶部,但我需要文本在它的右侧,当屏幕变小并且文本高度大于它需要的两个图像的高度时环绕它们。
另外,我怎样才能使图像在您调整浏览器大小时不调整大小,以便它们始终保持相同大小。
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">
<script src="https://code.jquery.com/jquery-3.2.1.slim.min.js" integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js" integrity="sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q" crossorigin="anonymous"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js" integrity="sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl" crossorigin="anonymous"></script>
<section id="about">
<div class="container">
<div class="row">
<div class="col-lg-6 col-md-12 col-sm-12">
<h1>About</h1>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit.
Illo suscipit facilis ipsum ullam reiciendis odio error
iste neque ratione libero rem accusamus voluptatibus, nihil
unde maiores sunt nisi. Assumenda, consectetur.
</p>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit.
Illo suscipit facilis ipsum ullam reiciendis odio error
iste neque ratione libero rem accusamus voluptatibus, nihil
unde maiores sunt nisi. Assumenda, consectetur.
</p>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit.
Illo suscipit facilis ipsum ullam reiciendis odio error
iste neque ratione libero rem accusamus voluptatibus, nihil
unde maiores sunt nisi. Assumenda, consectetur.
</p>
</div>
<div class="col-lg-6 col-md-12 col-sm-12">
<div class="row">
<div class="col-12">
<h1>About</h1>
</div>
<div class="col-6">
<div class="row">
<div class="col-12">
<img src="http://via.placeholder.com/350x150" alt="" style="width: 100%;
margin-bottom: 25px;" class="about-img">
</div>
<div class="col-12">
<img src="http://via.placeholder.com/350x150" alt="" style="width: 100%;
margin-bottom: 25px;" class="about-img">
</div>
</div>
</div>
<div class="col-6">
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit.
Illo suscipit facilis ipsum ullam reiciendis odio error
iste neque ratione libero rem accusamus voluptatibus, nihil
unde maiores sunt nisi. Assumenda, consectetur.
</p>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit.
Illo suscipit facilis ipsum ullam reiciendis odio error
iste neque ratione libero rem accusamus voluptatibus, nihil
unde maiores sunt nisi. Assumenda, consectetur.
</p>
</div>
</div>
</div>
</div>
</div>
</section>
你应该把图片和文字放在同一个col
。在图片上使用 float-left
,让文字环绕它们。
https://www.codeply.com/go/GNkJjFkPfP
<div class="row">
<div class="col-12 mb-3">
<img src="http://via.placeholder.com/350x150" class="float-left mr-3 about-img">
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit.
Illo suscipit facilis ipsum ullam reiciendis odio error
iste neque ratione libero rem accusamus voluptatibus, nihil
unde maiores sunt nisi. Assumenda, consectetur.
</p>
</div>
<div class="col-12 mb-3">
<img src="http://via.placeholder.com/350x150" class="float-left mr-3 about-img">
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit.
Illo suscipit facilis ipsum ullam reiciendis odio error
iste neque ratione libero rem accusamus voluptatibus, nihil
unde maiores sunt nisi. Assumenda, consectetur.
</p>
</div>
</div>
看起来您还有很多不必要的 row>col 嵌套。如果您不想调整图像大小,请删除 width:100%
。