gpt4 book ai didi

html - 在 block 中显示 2 个 div,在它们旁边显示垂直 div

转载 作者:行者123 更新时间:2023-11-28 15:56:55 25 4
gpt4 key购买 nike

我正在尝试设计一个包含 3 个图像的部分。我可以轻松地让两个图像按 block 显示。我可以将第三张图片向右浮动并轻松调整高度。但是我的问题是它没有并排对齐。下面是我想要实现的示例

enter image description here

这是我到目前为止的一个例子

.image-one,
.image-two {
width: 250px;
background-color: green;
display: block;
margin-top: 10px;
}

.image-three {
float: right;
background-color: lightblue;
width: 250px;
height: 200px;
}
<div class="container">
<div class="image-one">Hello</div>
<div class="image-two">Image two</div>
<div class="image-three"> Image three </div>
</div>

最佳答案

您应该能够简单地将 flex 添加到容器中,然后在左右 div 中添加内容。

这是一个工作示例:

.container {
display: -webkit-box;
display: -ms-flexbox;
display: flex;
}

.image-one,
.image-two {
width: 250px;
height: 95px;
background-color: green;
margin-bottom: 10px;
}

.image-three {
background-color: lightblue;
width: 240px;
height: 200px;
margin-left: 10px;
}
<div class="container">
<div class="left">
<div class="image-one">Hello</div>
<div class="image-two">Image two</div>
</div>
<div class="right">
<div class="image-three"> Image three </div>
</div>
</div>

关于html - 在 block 中显示 2 个 div,在它们旁边显示垂直 div,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48580220/

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