我想放置一个网格元素,使其始终位于网格的最后一行和/或最后一列。即使我不知道网格可能有多少行或列。这样的事情可能吗?
这将是我的网格:
.columns {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(min-content, 16.5rem));
grid-gap: 1rem;
}
我只找到了明确的行或列的位置: MDN
最佳答案
正在关注 my comment ;来自 https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Grid_Layout/Line-based_Placement_with_CSS_Grid#Counting_backwards
We can also count backwards from the block and inline end of the grid, for English that would be the right hand column line and final row line. These lines can be addressed as
-1
, and you can count back from there – so the penultimate line is-2
.
关于html - 是否可以明确地使网格项始终出现在最后一行或最后一列?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54941387/