So, I kept hearing this name floating around, mattgarbarino. Saw it mentioned in a few forums, maybe a blog comment somewhere. Someone shared a small code thing he supposedly wrote. You know how it is online, lots of names and snippets pop up and disappear. Didn’t think much of it at the time.

Fast forward a few weeks, I was banging my head against the wall on a personal project. Just a simple portfolio page I was tinkering with. I had this one section, needed to get a block of text perfectly centered, both ways, horizontal and vertical. Sounds easy, right? Well, I burned like half a day on it. Tried floats, messed with margins, went down the Flexbox rabbit hole, then tried Grid. Each time, it looked okay on my main browser, but then I’d check it on my phone or resize the window, and bam, broken layout. Super frustrating.
Trying Out That Snippet
Then I remembered that mattgarbarino thing. Had to search my history a bit to find it again. It was just a small chunk of CSS, honestly. Looked way too simple to actually fix my problem. My first thought was, “No way this works.” But hey, I was stuck, so why not?
I grabbed the code, pasted it into my CSS file. Hit refresh on my page. Nothing. Exactly what I expected, ha. Okay, maybe I missed something. Went back to where I found the code. Looked closer at his example structure. Ah, he had a specific parent container setup. My HTML was slightly different.
So, I tweaked my HTML just a little bit. Added an extra `div` wrapper around my text block, just like in his example. Made sure the class names matched up with his CSS snippet. Saved everything. Went back to the browser, holding my breath a little. Reloaded.
And just like that, it worked. The text block just snapped right into the middle. Perfectly centered. Resized the window, checked on my phone simulator – still perfect. Felt kind of dumb for spending hours before trying this simple thing.

What I Reckon About It
Now, here’s the thing. After looking at it properly, it wasn’t some kind of groundbreaking magic. It was just a clever mix of a couple of CSS properties. Stuff I knew about, but hadn’t thought to combine in that exact way for that specific problem.
- It worked for my specific case: Got the job done when other methods were giving me grief.
- Felt a bit fragile: I tried applying the same CSS to a slightly different element later, one without that exact parent setup, and it didn’t work right off the bat. Needed more fiddling.
- Not a universal fix: It’s useful, yeah, but only in certain situations. It’s not like you can just slap it everywhere and expect perfect centering.
It reminded me a lot of answers you find buried deep in forum threads. Someone finds a fix for their very specific setup, shares it, and it helps others with the exact same problem. But change one little thing, and you’re back to square one.
So, my final take? I actually kept his CSS for that one specific section on my little site. It’s still there, doing its job. Haven’t needed that exact trick since then, though. It’s another tool in the toolbox, I guess. Good to know it exists if I run into that specific headache again. It just goes to show, you always gotta try things out yourself. Reading about something online is one thing, but actually putting it into your own project and seeing what happens? That’s where you really learn if it’s useful or just noise. You gotta roll up your sleeves and do the work.