Menu

Why CSS zoom Shrinks Every Slide to 30%
📰

Why CSS zoom Shrinks Every Slide to 30%

DEV Community: css·orca forge·14 days ago
#PtICO37o
#devtocss#devto#dev#height#slide
Long article (1141 words) — no AI summary yet.
Reading 0:00
15s threshold

📝 Originally published (in Japanese) at forge.workstyle.tech .

TL;DR A slide fitting check measured a box whose min-height kept it at the viewport height. The scrollHeight and clientHeight comparison then kept reporting that the content did not fit, even as its zoom changed. The search reached its lower bound of 0.3 on both mobile and desktop.

TL;DR

All slides shrank to 30% because the box used for the fit check had a min-height set to the viewport height. Measuring the box kept reporting that the content did not fit, even as the scale changed, so the binary search shrank it to the 0.3 lower bound. The fix was to temporarily set the content’s min-height to 0, measure its offsetHeight , and then restore the original value.

How I Built a System That Shrinks Only Slides That Overflow

I used CSS zoom to add a system that shrinks only content that overflows. It measures the height, then uses binary search—a method that narrows the search range by half each time—to find a scale that fits.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.