Bootstrap 4轮播,背景为纯色,右侧为图片,左侧为文字

请问如果我问傻话,但是我需要创建一个全页滑块,以纯色为背景,左侧为一些文本,右侧为图像。类似于Google's Gmail Page。 目前我想要的结果是

Bootstrap 4轮播,背景为纯色,右侧为图片,左侧为文字

我用过Bootstrap 4的轮播

Bootstrap 4轮播,背景为纯色,右侧为图片,左侧为文字

我对其做了些微修改,并将其背景设为与Google图片一样的灰色。现在,我希望文本保持左对齐,并在右边具有自适应的自动可调整大小图像(或者即使我只能在文本顶部调整图像),在移动设备上查看时也可以响应。

Bootstrap 4轮播,背景为纯色,右侧为图片,左侧为文字

我正在使用this fiddle,并且将代码修改为

<mark>
seraph530 回答:Bootstrap 4轮播,背景为纯色,右侧为图片,左侧为文字

从轮播字幕中删除d-none类,然后尝试以下方式:

.carousel-item {
  height: 100vh;
  min-height: 350px;
  background: no-repeat center center scroll;
  -webkit-background-size: cover;
  -moz-background-size: cover;
  -o-background-size: cover;
  background-size: cover;
}
.text_part{
	display: none;
}
@media (max-width: 575px){
	.text_part{
	display: block;
}
.left_part{
	display: none;
}
}
  <section class="text_part">
    <div class="text">
     <h2 >your text</h2>
   </div>
 </section>

 <div id="carouselExampleIndicators" class="carousel slide" data-ride="carousel">
  <ol class="carousel-indicators">
    <li data-target="#carouselExampleIndicators" data-slide-to="0" class="active"></li>
    <li data-target="#carouselExampleIndicators" data-slide-to="1"></li>
    <li data-target="#carouselExampleIndicators" data-slide-to="2"></li>
  </ol>
  <div class="carousel-inner" role="listbox">
    <!-- Slide One - Set the background image for this slide in the line below -->
    <div class="carousel-item active" style="background-color: gray">
      <div class="carousel-caption  d-md-block">
        <div class="row">
          <div class="col-md-6 left_part">
            your text
          </div>
          <div class="col-md-6 col-sm-12">
           img
          </div>
        </div>
      </div>
    </div>
    <!-- Slide Two - Set the background image for this slide in the line below -->
    <div class="carousel-item" style="background-color: pink">
      <div class="carousel-caption  d-md-block">
        <div class="row">
          <div class="col-md-6 left_part">
            your text
          </div>
          <div class="col-md-6 col-sm-12">
           img
          </div>
        </div>
      </div>
    </div>
    <!-- Slide Three - Set the background image for this slide in the line below -->
    <div class="carousel-item" style="background-color: green">
     <div class="carousel-caption  d-md-block">
        <div class="row">
          <div class="col-md-6 left_part">
            your text
          </div>
          <div class="col-md-6 col-sm-12">
           img
          </div>
        </div>
      </div>
    </div>
  </div>
  <a class="carousel-control-prev" href="#carouselExampleIndicators" role="button" data-slide="prev">
    <span class="carousel-control-prev-icon" aria-hidden="true"></span>
    <span class="sr-only">Previous</span>
  </a>
  <a class="carousel-control-next" href="#carouselExampleIndicators" role="button" data-slide="next">
    <span class="carousel-control-next-icon" aria-hidden="true"></span>
    <span class="sr-only">Next</span>
  </a>
</div>

本文链接:https://www.f2er.com/3167672.html

大家都在问