【问题标题】:How to make each row has same height by using Bootstrap4 grid?如何使用 Bootstrap 4 网格使每一行具有相同的高度?
【发布时间】:2020-07-20 13:06:16
【问题描述】:

This is DOD's website

This is my website

.ce-list {
            display: block;
        }

        .ce-list .title:hover {
            text-decoration: underline;
        }

        .ce-list .img-warp {
            width: 100%;
            height: 100%;
            overflow: hidden;
        }

        .ce-list img {
            width: 100%;
            height: 100%;
            object-fit: cover;
            transition-duration: 0.5s;
        }

        .ce-list img:hover {
            transform: scale(1.1);
        }
<a href='' class='ce-list'>
                    <div class='row mb-4'>
                        <div class='col-4'>
                            <div class='img-warp'>
                                <img src='https://media.defense.gov/2020/Jul/16/2002457915/825/780/0/200512-F-YJ424-1020X.JPG'
                                    alt=''>
                            </div>
                        </div>
                        <div class='col-8'>
                            <div class='row'>
                                <p class='mb-1'><span>FEATURE</span> | <span>July 17, 2020</span></p>
                            </div>
                            <div class='row'>
                                <h2 class='title'>Intel, Recon Squadrons at Kadena Outsmart COVID-19</h2>
                            </div>
                            <div class='row'>
                                <p class=''>The COVID-19 pandemic has given rise to many obstacles, but through
                                    ingenuity and fighting spirit, airmen at Kadena Air Base, Japan, have persevered
                                    with new policies amid an unrelenting operations tempo.</p>
                            </div>
                        </div>
                    </div>
                </a>

看起来很相似,但是在我的网站中,每一行都有不同的高度,它随着图片的高度而变化。如何使用 bootstrap4 使每一行具有相同的高度?

【问题讨论】:

标签: javascript html jquery css twitter-bootstrap


【解决方案1】:

只需为此类图片添加一些样式即可。假设这些图片有一类 .newsimages - 你可以这样做:

.newsimages {
height:100px;
}

当然可以调整参数的值以适合您的布局。

【讨论】:

  • 嗯 - 否决我的答案的人至少可以说出原因......
猜你喜欢
  • 2018-07-16
  • 2019-10-24
  • 1970-01-01
  • 2018-08-12
  • 2013-01-17
  • 2016-06-22
  • 1970-01-01
  • 2017-07-21
  • 2016-09-21
相关资源
最近更新 更多