by divbzero · 5y ago · 0 comments
There's one thing that makes translate ridiculously powerful, though. Something totally unique in the CSS language.
When we use a percentage value in translate, that percentage refers to the element's own size, not the available space within the parent container.
Something I love to do with this is create "squishy" buttons that transform:scale(0.9) when under the :active pseudo-class (with a short transition set up for smooth animation). It's extra satisfying on touchscreens.