Simon Willison’s Weblog

Subscribe

Monday, 9th August 2021

The World of CSS Transforms. Comprehensive, clearly explained tutorial on CSS transforms by Josh W. Comeau, with some very neat interactive demos. I hadn’t understood how useful it is that the translate() transform treats percentages as applying to the dimensions of the element being transformed, not its parent. This means you can use expressions like transform: translateX(calc(100% + 4px)); to shift an element by its entire width plus a few more pixels.

# 2:30 pm / css, josh-comeau

2021 » August

MTWTFSS
      1
2345678
9101112131415
16171819202122
23242526272829
3031