html - 如何对齐这样的框?
问题描述
我想做的是下面的图片
但即使找到了一些信息,我也无法理解定位框。接下来我该怎么做?
<!-- html -->
<div class="boxbox">
<div class="box1">
<img src="E:\cloneoverwolf\img\overwolficon.jpg" alt=""> box article
</div>
<div class="box2">
<img src="E:\cloneoverwolf\img\overwolficon.jpg" alt=""> box article
</div>
<div class="box3">
<img src="E:\cloneoverwolf\img\overwolficon.jpg" alt=""> box article
</div>
</div>
<!-- css -->
.boxbox{
display: flex;
align-items: start;
justify-content: space-between;
}
解决方案
这是修复布局的简单方法之一。
.boxbox{
display: flex;
align-items: start;
justify-content: space-between;
}
img{
width:300px;
height:300px;
}
.box1,.box2{
width:50%
}
.box3{
width:50%;
margin:auto;
}
<div class="boxbox">
<div class="box1">
<img src="https://cdn.pixabay.com/photo/2015/11/28/17/55/paint-1067686_1280.jpg" alt=""> box article
</div>
<div class="box2">
<img src="https://cdn.pixabay.com/photo/2015/11/28/17/55/paint-1067686_1280.jpg" alt=""> box article
</div>
</div>
<div class="boxbox">
<div class="box3">
<img src="https://cdn.pixabay.com/photo/2015/11/28/17/55/paint-1067686_1280.jpg" alt=""> box article
</div>
</div>
或使用flex
.boxbox {
display: flex;
flex-wrap: wrap;
justify-content: space-between;
}
.box1,
.box2,
.box3 {
flex-basis: 50%;
min-height: 100px;
}
img {
width: 300px;
height: 300px;
}
.box3 {
margin: auto;
}
推荐阅读
- sql - 我们如何从 BigQuery 中删除重复数据并将其保存到另一个具有很多属性的表中
- flutter - 基于流的颤振小吃店展示
- swift - 如何调整正在打印的图像的大小?
- c# - 错误 8 程序集生成失败 -- 引用的程序集 'LibUsbDotNet' 没有强名称
- angular - 使用不同的 Angular 组件创建 Bootstrap 表
- php - 无法从 MySQL 获取结果 PHP 访问 JSON 对象
- ios - iOS - SMS 安全码自动填充本地化支持
- powershell - powershell中无法识别的参数gcloud命令
- ios - 无法呈现/推送另一个视图控制器
- coreldraw - CorelDraw 编号宏