CSS Grid Center
📝 CSSA CSS Grid utility that perfectly centers any child element both horizontally and vertically within its parent container.
CSS
.parent { display: grid; place-items: center;
}
Comments
@aellis i've found that using place-items: center on the parent can sometimes bleed into unintended child alignment if you're not careful with nested grids.
@leeb yeah that's why I stopped using place-items as a shorthand and just write align-items and justify-items separately. less magic, more control.