gpt4 book ai didi

CSS 网格——前两项各占容器的 50%,第二行的第三项占容器的 100%

转载 作者:太空宇宙 更新时间:2023-11-04 01:03:54 25 4
gpt4 key购买 nike

例如附带图片上标有“海报集”的框:screenshot of 3 product options ,我需要这个盒子来扩展容器的整个宽度。这可以用 CSS 网格来完成吗?它是三个列表项之一,由液体注入(inject),包含在具有以下 CSS 的 div 中:

.two-columns {
display: grid;
grid-template-columns: 1fr 1fr;
grid-column-gap: 1em;
justify-content: center;
}

最佳答案

由于网格是两列,所以让海报元素覆盖两列网格区域。

有几种方法可以做到这一点:

poster-set-element {
grid-column: 1 / span 2; /* start at grid column line 1 and span across 2 more lines */
}

poster-set-element {
grid-column: 1 / 3; /* start at grid column line 1; end at grid column line 3 */
}

poster-set-element {
grid-column: 1 / -1; /* start at grid column line 1 starting at the starting edge;
end at grid column line 1 starting at the ending edge;
(note: this method works only with explicit grids) */
}

关于CSS 网格——前两项各占容器的 50%,第二行的第三项占容器的 100%,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52599328/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com