如何删除最后一个差距网格
我应该如何制作5个盒子的布局?到目前为止,这就是我所能做的。但是问题在于,网格的最后一项仍然在其下方有差距。 我只能为容器提供样式的组件。
const Container = styled('div')`
width: 100%;
height: 100%;
display: grid;
grid-template-columns: 2fr 3fr 1fr;
grid-template-rows: 5fr 0.75fr 1fr;
gap: 10px;
& > div {
min-height: 20px;
}
& > .container-live-call {
grid-column: 1 / span 3;
background-color: ${({ theme }) => theme.color.secondary.$100};
}
& > .container-live-call-map {
grid-row: 2 / span 3;
background-color: ${({ theme }) => theme.color.secondary.$100};
}
& > .container-live-call-info {
grid-row: 2 / span 3;
background-color: ${({ theme }) => theme.color.secondary.$100};
}
& > .container-live-call-volume {
grid-column: 3;
background-color: ${({ theme }) => theme.color.secondary.$100};
}
& > .container-live-call-voice {
grid-column: 3;
background-color: ${({ theme }) => theme.color.secondary.$100};
}
`;
<Container>
<div className="container-live-call"></div>
<div className="container-live-call-map"></div>
<div className="container-live-call-info"></div>
<div className="container-live-call-volume"></div>
<div className="container-live-call-voice">
<button onClick={() => setOpen(false)}>Click me to close</button>
</div>
</Container>
How should I make a layout with 5 boxes ? So far, this is all I can do. But the problem is that the last item of the grid still has a gap below it.
I only able to provide styled component for Container.
const Container = styled('div')`
width: 100%;
height: 100%;
display: grid;
grid-template-columns: 2fr 3fr 1fr;
grid-template-rows: 5fr 0.75fr 1fr;
gap: 10px;
& > div {
min-height: 20px;
}
& > .container-live-call {
grid-column: 1 / span 3;
background-color: ${({ theme }) => theme.color.secondary.$100};
}
& > .container-live-call-map {
grid-row: 2 / span 3;
background-color: ${({ theme }) => theme.color.secondary.$100};
}
& > .container-live-call-info {
grid-row: 2 / span 3;
background-color: ${({ theme }) => theme.color.secondary.$100};
}
& > .container-live-call-volume {
grid-column: 3;
background-color: ${({ theme }) => theme.color.secondary.$100};
}
& > .container-live-call-voice {
grid-column: 3;
background-color: ${({ theme }) => theme.color.secondary.$100};
}
`;
<Container>
<div className="container-live-call"></div>
<div className="container-live-call-map"></div>
<div className="container-live-call-info"></div>
<div className="container-live-call-volume"></div>
<div className="container-live-call-voice">
<button onClick={() => setOpen(false)}>Click me to close</button>
</div>
</Container>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
.container-live-call-map
和.container-live-call-info
规则正在为4个行增加一个行(而不是<<<<3代码>网格 - 板行),因为它们从第2行开始,跨越了3行。如果将它们更改为:这应该摆脱在网格的最后一件以下的额外行/间隙。
The
.container-live-call-map
and.container-live-call-info
rules are adding an additional row to 4 total rows (instead of 3 as defined ingrid-template-rows
) because they are starting at row 2 and spanning 3 rows. If you change them to:This should get rid of that extra row/gap below the last item of the grid.