html - 如何通过以下方式使用 HTML 和 CSS 定位 3 个图像?
解决方案
您可以使用网格来执行此操作
.grid {
display: grid;
grid-template-columns: 1fr 1fr;
grid-template-rows: 1fr 1fr;
width: 100%;
grid-gap: 4px;
}
img {
max-width: 100%;
}
img:first-child {
max-width: unset;
height: 100%;
width: 100%;
object-fit: cover;
grid-row: span 2;
}
<div class="grid">
<img src="https://images.unsplash.com/photo-1618326985678-88285545a9aa?crop=entropy&cs=srgb&fm=jpg&ixid=MnwxNDU4OXwwfDF8cmFuZG9tfHx8fHx8fHx8MTYyMDc5OTgyNA&ixlib=rb-1.2.1&q=85" alt="">
<img src="https://images.unsplash.com/photo-1618326985678-88285545a9aa?crop=entropy&cs=srgb&fm=jpg&ixid=MnwxNDU4OXwwfDF8cmFuZG9tfHx8fHx8fHx8MTYyMDc5OTgyNA&ixlib=rb-1.2.1&q=85" alt="">
<img src="https://images.unsplash.com/photo-1618326985678-88285545a9aa?crop=entropy&cs=srgb&fm=jpg&ixid=MnwxNDU4OXwwfDF8cmFuZG9tfHx8fHx8fHx8MTYyMDc5OTgyNA&ixlib=rb-1.2.1&q=85" alt="">
</div>
推荐阅读
- google-apps-script - Apps 脚本:如何以编程方式调整带有包裹单元格的 Google 表格行的大小,使其小于包裹的文本
- linux - How to Get Fully Functional PowerShell running on Linux?
- amazon-web-services - Golang AWS API Gateway 无效字符“e”寻找值的开头
- javascript - bind 如何与 new 和 instanceof 一起工作?
- sql - Query result in a single row or multiple values in single with comma separated
- javascript - Firebase how to find child knowing its id but not its parent's id (js)
- spring - Spring Boot:错误:提交响应后无法调用 sendError()
- html - 如何在组件的返回值中设置跨度标签
- sql - BigQuery: LAG() on UNNEST()
- jquery - How can I get the src attributes of each image element with the same class in JQuery?