【发布时间】:2022-01-01 16:06:46
【问题描述】:
有人能告诉我如何并排添加 1 张图片,如图所示,我的意思是完全响应
.container {
margin: auto;
width: 78vw;
height: 50vh;
background-color: aqua;
border-radius: 10%;
display: flex;
flex-direction: row;
justify-content: space-between;
flex-wrap: wrap;
}
.big-image {
background: url("https://media.istockphoto.com/photos/nothing-better-than-sliding-into-bed-with-a-good-read-picture-id929998552?b=1&k=20&m=929998552&s=170667a&w=0&h=GkJP5lHXoyVLYDIa86G6stcyEvoaAgN7xBFqgrc3QH8=");
width: 65%;
height: auto;
background-size: contain;
background-repeat: no-repeat;
}
.twoSmallImages {
display: flex;
flex-direction: column;
justify-content: start;
width: 33%;
height: 100%;
}
.img1 {
background: url("https://media.istockphoto.com/photos/nothing-better-than-sliding-into-bed-with-a-good-read-picture-id929998552?b=1&k=20&m=929998552&s=170667a&w=0&h=GkJP5lHXoyVLYDIa86G6stcyEvoaAgN7xBFqgrc3QH8=");
width: 100%;
height: 45%;
background-size: contain;
background-repeat: no-repeat;
margin: 2px auto;
background-color: #fff;
}
.img2 {
background: url("https://media.istockphoto.com/photos/nothing-better-than-sliding-into-bed-with-a-good-read-picture-id929998552?b=1&k=20&m=929998552&s=170667a&w=0&h=GkJP5lHXoyVLYDIa86G6stcyEvoaAgN7xBFqgrc3QH8=");
width: 100%;
height: 45%;
background-size: contain;
background-repeat: no-repeat;
margin: 2px auto;
background-color: brown;
}
<div class="container">
<div class="big-image"></div>
<div class="twoSmallImages">
<div class="img1"></div>
<div class="img2"></div>
</div>
</div>
【问题讨论】:
-
分享代码?
-
codepen.io/yogeskumar/pen/yLoWXwj 这是我试过的代码
-
当图像的纵横比意味着它们不完全适合容器的纵横比时,您希望发生什么?