UI Scaling – A Dev Diary on Something I Should’ve Looked Into Sooner

Nikita SarkaniaNikita Sarkania
3 min read

Hey there 👋
So here's a little behind-the-scenes moment from my dev life.

I built this UI that looked great on my screen. Everything felt balanced — the layout, fonts, spacing, all of it. I was pretty happy with it.

Then someone opened it on a screen with a different resolution…
And things looked just a little off.

Not broken. But not polished either. Margins felt weird, font sizes looked inconsistent, and the layout didn’t quite breathe the same way.

That’s when I realized I’d never actually paid attention to UI scaling.


🎯 What Even Is UI Scaling?

If you're like me, you might’ve focused on making things responsive — stacking content on smaller screens, hiding/showing elements, using media queries. All good stuff.

But UI scaling is a bit deeper. It’s about ensuring your UI adjusts smoothly and proportionally across different screen sizes and resolutions.

Think:

  • Text that doesn’t look too tiny on high-res screens

  • Layouts that don’t feel cramped or stretched

  • Consistency in spacing and proportions — everywhere


💡 What I Was Already Doing

I’d already switched to using relative units — like rem, em, %, vh, and vw — a while back.

And that made a difference.

.card {
  padding: 2rem;
  font-size: 1.2rem;
  width: 80%;
}

It gave my layouts some flexibility and breathing room. They didn’t fall apart when screen sizes changed, and I didn’t have to keep tweaking pixel values.

✨ My New Discovery: clamp()

Recently, I came across this magical CSS function called clamp() — and wow, I wish I’d learned about it earlier.

It lets you set:

  • a minimum value

  • a preferred (fluid) value

  • and a maximum value

All in one line.

font-size: clamp(1rem, 2vw, 1.5rem);

This means your font size will:

  • Never go below 1rem

  • Scale with 2vw (viewport width)

  • But also never exceed 1.5rem

It’s super handy for headings, spacing, and other values that should scale but stay within reason.


🔧 What I’m Experimenting With Now

I’m still in the early phase of figuring this stuff out, but here’s what’s on my radar:

  • ✏️ Using clamp() for not just fonts, but paddings and margins too

  • 🧱 Fluid layouts that scale between breakpoints, not just snap to new ones

  • 🖼 Making sure icons and images scale gracefully without looking stretched or blurry

  • ⚡ Trying out container queries (next on my list!)


📦 Some Quick Tips from My Experience

If you're starting to think about UI scaling too, here’s what’s helped me so far:

  • Avoid hardcoded pixel values — they rarely scale well

  • Start mobile-first, then scale up

  • Use rem for font sizes to respect root sizing and accessibility

  • Try clamp() for smoother, more responsive typography

  • Always preview your UI on multiple screen sizes/resolutions — not just widths!


🧵 Wrapping It Up

I used to think UI scaling was something "nice to have."
Now I see it's pretty much essential — especially if you're building things that need to look consistent across all kinds of screens.

I’m still experimenting, still learning, and still tweaking my process — but even the small changes I’ve made so far have made a huge difference.

If you're also diving into this world, or have tips to share — feel free to drop a comment. Would love to learn from your experience too!

Until next time,
– Nikita 👩‍💻

0
Subscribe to my newsletter

Read articles from Nikita Sarkania directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Nikita Sarkania
Nikita Sarkania