Dev Helpers

CSS / Media treatments

Zoomed detail window

Dev Helpers · June 26, 2026

A magnified detail window needs a clipping area and an independently scaled subject. Scaling the outer frame would enlarge the wrong part.

Worked example

<style>
  .demo {
    overflow: hidden;
    width: 9rem;
  }
  .demo img {
    transform: scale(1.6);
    transform-origin: 60% 30%;
  }
</style>
<figure class="demo">
  <img
    alt="Study in geometric shapes"
    width="150"
    height="72"
    src="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='150' height='72'%3E%3Ccircle cx='80' cy='30' r='20' fill='teal'/%3E%3C/svg%3E"
  />
</figure>

Implementation notes

A purely decorative magnifier should not hide the original detail from keyboard or touch users. If the detail is necessary, provide a separate accessible view.

Try it yourself

Compare the frame dimensions before and after applying the transform.

Open the CSS example →

Editorial date June 26, 2026 · Published December 6, 2026

Related articles

Fluid width with a maximum

A fluid container needs a small-screen width and a large-screen maximum. Outer gutters should remain visible at both extremes.

Square aspect ratio

A square ratio reserves equal sides even before media loads. Fit rules decide whether rectangular content is cropped or letterboxed.