css - Bootstrap 4 : col same size as right col & image fill col

标签 css twitter-bootstrap

在我的左边col我有一个 <img>在我的右边col我有一些文字。我要左边col与右侧高度相同col .然后我想要 <img>填补左边col .看起来很简单,但我做不到。这是我当前的代码:

                <div class="row">
                <div class="col-6 h-100">
                    <img class="img-fluid" src="@/assets/images/employee4.jpg">
                </div>
                <div class="col-6">
                    <h1 class="heading">HERREN</h1>
                    <hr>
                    <div class="row">
                        <h2 class="serivce">SCNHEIDEN</h2>
                        <h2 class="price float-right">18€</h2>
                    </div>
                    <div class="row">
                        <h2 class="serivce">SCNHEIDEN</h2>
                        <h2 class="price float-right">18€</h2>
                    </div>
                    <div class="row">
                        <h2 class="serivce">SCNHEIDEN</h2>
                        <h2 class="price float-right">18€</h2>
                    </div>
                    <div class="row">
                        <h2 class="serivce">SCNHEIDEN</h2>
                        <h2 class="price float-right">18€</h2>
                    </div>
                    <div class="row">
                        <h2 class="serivce">SCNHEIDEN</h2>
                        <h2 class="price float-right">18€</h2>
                    </div>
                    <div class="row">
                        <h2 class="serivce">SCNHEIDEN</h2>
                        <h2 class="price float-right">18€</h2>
                    </div>
                </div>
            </div>

看起来像这样: enter image description here

如你所见,左边col有右边的高度col而不是相反,图像不填充 `col``

有什么想法吗?

最佳答案

将该图像设置为左列的背景图像

CSS代码

#leftcol {
background-image:url("image url");
background-size:cover;

}

关于css - Bootstrap 4 : col same size as right col & image fill col,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52018470/

相关文章:

html - Bootstrap : fixed space between columns?

javascript - 使网格系统中单元格的垂直重新排序响应迅速

css - 如何使用 angular js 创建响应式菜单?

html - CSS 绝对定位(4 颗钻石靠在一起)

html - css transform flip 在转换时禁用点击事件

javascript - 切换背景图像 MVC

css - 彩色 Bootstrap Glyphicons 打印成黑色

Safari 中的 CSS 错误,但 Chrome/Firefox 中没有

javascript - 如何使用 jquery 更改 twitter bootstrap 中的按钮

html - 我将 Bootstrap 4 用于导航栏。我无法更改包装 div 元素的背景颜色