我有一个特殊的问题。我正在使用Angular,我正在开发一个甘特时间轴,我有一个div容器,其中包含以下css:
.container {
display: grid;
margin: 15px 12px 0 0;
grid-template-rows: repeat(20, 1fr) auto;
grid-template-columns: [one-January-2023] 0.97fr [two-January-2023] 0.97fr [three-January-2023] 0.97fr [four-January-2023] 0.97fr [five-January-2023] 0.97fr [six-January-2023] 0.97fr [seven-January-2023] 0.97fr [eight-January-2023] 0.97fr [nine-January-2023] 0.97fr [ten-January-2023] 0.97fr [eleven-January-2023] 0.97fr [twelve-January-2023] 0.97fr [thirteen-January-2023] 0.97fr [fourteen-January-2023] 0.97fr [fifteen-January-2023] 0.97fr [sixteen-January-2023] 0.97fr [seventeen-January-2023] 0.97fr [eighteen-January-2023] 0.97fr [nineteen-January-2023] 0.97fr [twenty-January-2023] 0.97fr [twenty-one-January-2023] 0.97fr [twenty-two-January-2023] 0.97fr [twenty-three-January-2023] 0.97fr [twenty-four-January-2023] 0.97fr [twenty-five-January-2023] 0.97fr [twenty-six-January-2023] 0.97fr [twenty-seven-January-2023] 0.97fr [twenty-eight-January-2023] 0.97fr [twenty-nine-January-2023] 0.97fr [thirty-January-2023] 0.97fr [thirty-one-January-2023] 0.97fr
}
这就是HTML:
<div class="container">
<div style="grid-column-start: four-January-2023; grid-column-end: twenty-January-2023">
<div style="grid-column-start: ten-January-2023; grid-column-end: twenty-eight-January-2023">
</div>
我想让容器中的每个div(在ngFor指令中动态呈现)在后续行中处理。我如何才能获得此目标?
1条答案
按热度按时间tkclm6bt1#
要将两个div元素放置在此网格中的一行中,可以使用
grid-row
属性为两个div指定同一行:这样就可以放置
div
元素。