我有一个使用CSS Grid布局构建的卡片。左侧可能有一张图片,右上方可能有一些文本,右下方可能有一个按钮或链接。
在下面的代码中,我如何使绿色区域尽可能地占据空间,同时使蓝色区域尽可能少地占用空间?
绿色应该将蓝色区域向下推。
在下面的代码中,我如何使绿色区域尽可能地占据空间,同时使蓝色区域尽可能少地占用空间?
绿色应该将蓝色区域向下推。
https://jsfiddle.net/9nxpvs5m/
.grid {
display: grid;
grid-template-columns: 1fr 3fr;
grid-template-areas:
"one two"
"one three"
}
.one {
background: red;
grid-area: one;
padding: 50px 0;
}
.two {
background: green;
grid-area: two;
}
.three {
background: blue;
grid-area: three;
}
<div class="grid">
<div class="one">
One
</div>
<div class="two">
Two
</div>
<div class="three">
Three
</div>
</div>
.two
和.three
:https://jsfiddle.net/9nxpvs5m/2/ - domsson