gpt4 book ai didi

css - 响应式背景,其高度基于使用 Bootstrap 的相邻列

转载 作者:太空宇宙 更新时间:2023-11-03 17:29:28 26 4
gpt4 key购买 nike

我怎样才能在一个列中有一个完整的图像背景,但不知道它的高度?我正在使用 bootstrap,我需要图像能够响应。请看image为了更好的理解

<div class="  col-xs-12 col-sm-5 col-md-5 col-lg-4 bgimage">
</div>
<div class=" col-xs-12 col-sm-7 col-md-7 col-lg-8">
</div>
with .bgimage
{
background-image: url(../img/user.jpg);

background-size: cover;

}

最佳答案

这是一个包含 background-size:cover

的列的 Bootstrap 示例

http://jsfiddle.net/maio/7rbjj2fn/3/

.bgimage{
background-image: url(http://oi58.tinypic.com/2u9mo0g.jpg);
background-size: cover;
height:200px
}
.right{
background:yellow;
height:100%;
}
.row{
background:tomato
}
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css" rel="stylesheet"/>
<div class='row'>
<div class=" col-sm-5 col-md-5 col-lg-4 bgimage">
</div>
<div class="right col-sm-7 col-md-7 col-lg-8">
Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa. nascetur ridiculus mus. Donec quam felis, ultricies nec, pellentesque eu, pretium quis, sem. Nulla consequat massa quis enim. Donec pede justo, fringilla vel, aliquet nec, vulputate eget, arcu. In enim justo, rhoncus ut, imperdiet a, venenatis vitae, justo. Nullam dictum felis eu pede mollis pretium. Integer tincidunt. Cras dapibus. Vivamus elementum semper nisi. Aenean vulputate eleifend tellus. Aenean leo ligula, porttitor eu, consequat vitae, eleifend ac, enim. Aliquam lorem ante, dapibus in, viverra quis, feugiat a, tellus. Phasellus viverra nulla ut metus varius laoreet. Quisque rutrum. Aenean imperdiet. Etiam ultricies nisi vel augue. Curabitur ullamcorper

关于css - 响应式背景,其高度基于使用 Bootstrap 的相邻列,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30872652/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com