Skip to content
DevMeme
3909 of 7435
The CSS Paradox: Easy 3D Effects, Impossible Squares
Frontend Post #4255, on Feb 27, 2022 in TG

The CSS Paradox: Easy 3D Effects, Impossible Squares

Description

This image is a screenshot of a developer comment from a forum with a dark theme, likely Stack Overflow. The comment, posted by a user named Jonathan on September 29, 2014, has 79 upvotes and reads: 'I hate how you can do 3D transforms, shadows, rounded corners, etc easily in CSS, but to have a square div requires a hack...'. The humor stems from a long-standing frustration in the world of frontend development. For many years, CSS provided powerful tools for complex aesthetic effects like animations and 3D transformations, yet lacked a simple, direct way to maintain an element's aspect ratio, such as making a div a perfect square that resizes proportionally. Developers had to resort to clever but unintuitive 'hacks,' most famously the 'padding-bottom' trick. While modern CSS has since introduced the 'aspect-ratio' property, this meme resonates deeply with experienced developers who remember the era when creating a simple square was ironically harder than a rotating 3D cube

Comments

13
Anonymous ★ Top Pick The 'square div hack' was the original frontend coding challenge. It didn't just test your CSS knowledge; it tested your ability to accept that sometimes the simplest shapes require the most complex thinking
  1. Anonymous ★ Top Pick

    The 'square div hack' was the original frontend coding challenge. It didn't just test your CSS knowledge; it tested your ability to accept that sometimes the simplest shapes require the most complex thinking

  2. Anonymous

    CSS: the only place where you can orbit a div in hardware-accelerated 3D with a single line, but need a 40-message thread, two pseudo-elements, and a promise to finally drop IE11 just to convince it that width = height

  3. Anonymous

    After 15 years in the industry, I've mastered distributed systems, scaled to millions of users, and debugged kernel panics... but I still Google 'CSS center div' every single time because apparently that's the real NP-complete problem

  4. Anonymous

    CSS will rotate a div in 3D space with a perspective origin, but ask it for a square and suddenly you're reinventing geometry with padding-top: 100%

  5. Anonymous

    Ah yes, CSS in 2014: where you could rotate a div in 3D space, cast photorealistic shadows, and round corners with surgical precision - but creating a perfect square required either the `padding-bottom: 100%` hack, JavaScript intervention, or a blood sacrifice to the box model gods. It's the web platform equivalent of having a spaceship that can do interstellar travel but needs duct tape to keep the door closed. Modern CSS finally gave us `aspect-ratio`, but we'll never forget the years spent explaining to designers why 'just make it square' wasn't actually 'just' anything

  6. Anonymous

    CSS: matrix3d() for Hollywood flips is trivial, but square div? Cue the pseudo-element incantation

  7. Anonymous

    CSS can animate a 3D cube at 60fps, but pre aspect-ratio “make it a square” meant lying to the box model with padding-bottom: 100% and a pseudo-element

  8. Anonymous

    Only CSS could ship perspective(1000px) and GPU‑accelerated cubes years before aspect-ratio, leaving our production codebase as a museum of padding-bottom: 100% relics

  9. @s2504s 4y

    When should I laugh? (Жду пояснительную бригаду)

  10. @RiedleroD 4y

    it required a hack back when this was posted - 2014 didn't have CSS3

    1. @RiedleroD 4y

      though, I do wonder: why is a deprecated statement posted here? 🤔

  11. Inklingboiii 4y

    aspect-ratio: 1/1;

  12. @azizhakberdiev 4y

    width: 50px height: 50px That's impossible I guess

Use J and K for navigation