DEV Community

Discussion on: Use CSS Grid to create a self-centering full-width element

Collapse
 
walidvb profile image
Walid

Had not thought of that, until now i was always using the padding trick!

padding: 0 calc(50% - var(--half-column-width));

codepen.io/walidvb/pen/VopNNO

Collapse
 
brob profile image
Bryan Robinson

Ooooh that's an interesting trick. I've never seen that, but it makes total sense! Gotta love calc()!

Collapse
 
walidvb profile image
Walid

@leaverou ;)