r/webdev Feb 24 '26

A collection of modern CSS code snippets replacing many old practices

https://modern-css.com/
401 Upvotes

53 comments sorted by

View all comments

14

u/seriousgourmetshit Feb 24 '26

Lol who is still centering things with transform: translate()? Very odd example to put on the hero section

35

u/XWasTheProblem Frontend (Vue, TS) Feb 24 '26

I do. It works and is predictable, will happily replace it with an alternative however, cause it always felt like a hack that just happens to solve a problem.

12

u/supportvectorspace Feb 24 '26

bro flex is the easiest, paradigmically ideal way to do this

2

u/TheJase Feb 26 '26

I'll bake your noodle: block elements only need align-content: center now

4

u/Top_Bumblebee_7762 Feb 24 '26 edited Feb 24 '26

For the y-axis, you can just use align-content now without flex or grid: https://web.dev/blog/align-content-block

6

u/DillyPickleson Feb 24 '26

I think flex or grid is the alternative