T
4

Someone on here told me my CSS was 'over-engineering' and they were right

I was making a simple card hover effect. Had like 40 lines of code with transforms, pseudo-elements, and keyframes. A user named pixel_puncher said 'just use outline-offset and scale, man.' I was mad at first. But I tried it. Cut my code down to 8 lines. The effect actually looked cleaner too. No extra divs, no crazy z-index stacking. Now I always ask myself 'can I do this with one property instead of three?' Really changed how I approach CSS battles. Has anyone else gotten a blunt critique that actually made you better?
3 comments

Log in to join the discussion

Log In
3 Comments
the_aaron
the_aaron9d ago
wait wait wait, pIXEL_PUNCHER just casually dropped that wisdom on you? lol that is wild. i would have been so salty at first too, like who is this random telling me my 40 line masterpiece is wrong. but man, outline-offset is one of those properties i always forget exists and then when i see it used right it blows my mind. i had a similar thing happen when someone told me my nav menu was over engineered because i was using like three event listeners when i could have just used :focus-within. i was legit mad for a day but now i use that trick all the time. its embarrassing how much we complicate stuff when the simple answer is right there if we just stop showing off, lol.
6
felix_martin56
@the_aaron what was your first thought when you discovered :focus-within could replace all that?
2
jade618
jade6189d ago
My buddy spent 3 hours on JS dropdowns, then saw :focus-within and rage-quit for the day
7