图像网格,一个图像与2或3个图像的高度相同

时间:2019-02-20 10:36:00

标签: bootstrap-4

我想知道如何使用Bootstrap 4进行​​图像网格处理。

我希望左侧图像的高度与右侧图像的高度相同。

<div class="container">
    <div class="row">
        <div class="col-md-6">
            Big-image height 100%
        </div>
        <div class="col-md-6">
            <div class="col-md-12">
                image height 50%
            </div>
            <div class="col-md-12">
                image height 50%
            </div>
        </div>
    </div>
</div>

这是我没有引导程序4的方式 https://www.bootply.com/zCta1mIN70

<div class="w100">
    <div class="container">
        <main class="gridnews">
            <figure class="figure1">
                <div class="childelement">
                    <img class="figure-img" src="https://via.placeholder.com/350x150">
                </div>
            </figure>
            <figure class="figure2">
                <div class="childelement">
                    <img class="figure-img" src="https://via.placeholder.com/350x150">
                </div>
            </figure>
            <figure class="figure3">
                <div class="childelement">
                    <img class="figure-img" src="https://via.placeholder.com/350x150">
                </div>
            </figure>
        </main>
    </div>
</div>

1 个答案:

答案 0 :(得分:1)

您好,这是您的 Bootstrap 4 代码!

  

请全屏预览

.image-wrapper-first img {
    width:100%;
    height:350px;
}
.image-wrapper-second img {
     width:100%;
    height:170px;
}
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js" integrity="sha384-UO2eT0CpHqdSJQ6hJty5KVphtPhzWj9WO1clHTMGa3JDZwrnQq4sF86dIHNDz0W1" crossorigin="anonymous"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js" integrity="sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM" crossorigin="anonymous"></script>
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
    <!------ Include the above in your HEAD tag ---------->

    <!--Container-->
  <div class="container">
   <!--SECTION START-->
     <section class="row">
        <div class="col-md-7">
           <div class="ratio_right-cover-2 image-wrapper-first">
              <img class="figure-img" src="https://via.placeholder.com/350x150">                  
            </div>
          </div>
                    
          <div class="col-md-4">
               <div class="ratio_right-cover-2 image-wrapper-second">
                   <img class="figure-img" src="https://via.placeholder.com/350x150">
                </div>
                <div class="ratio_right-cover-2 image-wrapper-second">
                    <img class="figure-img" src="https://via.placeholder.com/350x150">
                    </div>
                 </div>
                </section>
                <!--END SECTION-->
            </div>