我想在容器的中心对齐一些元素,容器有一个显示网格.在这个元素的中心,有网格间隙.
所以我想把我的元素,两个按钮与箭头对齐,在最中心(那里有7).
我知道它可以很好地使用绝对位置,但我真的想避免它,因为我使用的是带有过渡的svelte,而使用绝对位置会改变元素的位置.
下面是我的页面和网格布局的图片:
下面是代码
.content-container {
display: -ms-grid;
display: grid;
min-height: 0;
min-width: 0;
grid-auto-flow: dense;
min-height: 100vh;
min-width: 100vw;
grid-template-columns: repeat(12, minmax(0, 1fr));
gap: 50px;
//adding the padding to the container
padding: 50px;
background: blue;
}
.nav-link {
align-self: start;
justify-self: center;
}
.nav-link.work {
align-self: end;
}
<section class="content-container">
<div class="nav-link about">
btn
</div>
<div class="nav-link work">
btn
</div>
</section>