The Easy Way to Pick Perfect Spacing — Transcript

Learn how to pick perfect spacing in UI design using rem units for scalable, consistent, and user-friendly layouts.

Key Takeaways

  • Spacing should scale with font size using rem units.
  • Start with generous spacing and reduce as needed.
  • Group related elements tightly and separate groups with larger gaps.
  • Maintain visual balance by keeping inner spacing smaller than outer padding.
  • Consistency in spacing is key to a clean and user-friendly UI.

Summary

  • Use rem units instead of pixels for spacing to ensure scalability with font size.
  • Start spacing with larger values and decrease if needed for better user experience.
  • Group closely related UI elements with smaller spacing and separate distinct groups with larger spacing.
  • Maintain smaller inner spacing than outer spacing in buttons for visual balance.
  • Vertical padding should be smaller than horizontal padding due to optical weight of text.
  • Consistency in spacing is crucial for a clean and understandable UI, even if spacing values are not perfect.
  • Spacing values like 0.5 rem for close grouping, 1 rem for padding, and 1.5-2 rem for separation are recommended but context-dependent.
  • Test different spacing values to find the best fit for your design.
  • Use tools like Mobin for design inspiration and improving design choices.
  • Proper spacing improves readability, navigation, and overall user experience.

Full Transcript — Download SRT & Markdown

00:00
Speaker A
Let's start by setting the right spacing for this list.
00:03
Speaker A
Should I make it tighter or more spacious, should I keep the same space for the heading or move it a bit further or closer to the list?
00:10
Speaker A
But before we start,
00:11
Speaker A
I need to clarify a few points, this is a 27 inch 2K monitor.
00:17
Speaker A
So I have scaled the design to make things legible at smaller screen sizes as well.
00:22
Speaker A
And throughout the video, most of the font size is one rem, which is 16 pixels.
00:27
Speaker A
I will use rem instead of pixels because we want our spacing to scale with the font size.
00:30
Speaker A
This helps create a spacing system that is consistent and useful for any UI you can imagine.
00:37
Speaker A
For instance, let's look at this list as an example.
00:41
Speaker A
If we want to try a smaller gap, we don't have to guess a random pixel value.
00:45
Speaker A
We can just go like this, and we can do the same for higher values as well.
00:48
Speaker A
Just increment by 0.25 rem or 4 pixels.
00:54
Speaker A
So at a smaller scale, the spacing system looks like this.
00:58
Speaker A
In most cases, you will be reaching for a one rem spacing because most of the elements are one rem font size.
01:03
Speaker A
For example, with this list, we can start by setting a one rem spacing between all elements.
01:09
Speaker A
And then, we can increase the spacing for the heading because it is not part of the list itself.
01:15
Speaker A
And that's the most important role of spacing.
01:20
Speaker A
Grouping and separating UI elements to help users navigate the interface.
01:25
Speaker A
For example, if you put equal spacing between these three actions, the UI will look cluttered.
01:30
Speaker A
Users will have to think for a second regarding which button belongs to which group.
01:36
Speaker A
Start by grouping the elements with the smallest space possible.
01:40
Speaker A
Then increase the spacing between distinct groups by one rem.
01:45
Speaker A
It could be two rem as well if you have the space, it all depends on the context and your preference.
01:50
Speaker A
Just make sure that this space is smaller than the outer space.
01:56
Speaker A
For instance, look at a button like this.
01:58
Speaker A
The inner spacing between the icon and the text should always be smaller than the outer spacing or the horizontal padding of the button.
02:05
Speaker A
Otherwise, the button will look ugly and confusing to the user.
02:09
Speaker A
You can use the same spacing if you really want to.
02:11
Speaker A
But never make the outer spacing smaller than the inner spacing.
02:15
Speaker A
You only put more inner spacing between elements when they serve a different purpose.
02:20
Speaker A
In this case, the inner space between the like and dislike buttons is greater than the outer padding.
02:27
Speaker A
However, if you notice the inner space for the button itself is still smaller than the padding.
02:32
Speaker A
And you can always try a bigger padding.
02:36
Speaker A
So the button looks nice and clean at all screen sizes.
02:39
Speaker A
And of course, test different spacing to see which one is the best for your design.
02:43
Speaker A
But let us get back to these buttons because I want to talk about vertical padding.
02:49
Speaker A
Have you noticed that the vertical padding is smaller than the horizontal padding?
02:53
Speaker A
There is a concept called optical weight.
02:55
Speaker A
Text has more visual noise on the left and right sides because of the varying widths of letters.
03:01
Speaker A
Like U versus W.
03:02
Speaker A
Vertical space is much more constrained by the cap height, which is the height of flat capital letters, and descenders, which are the tails on letters like Y or G.
03:10
Speaker A
So if you put equal vertical padding, that unnecessary space will look off.
03:15
Speaker A
And make the button look bloated and ugly.
03:18
Speaker A
For buttons, just pick a smaller value for the vertical padding.
03:22
Speaker A
And two times or three times the horizontal padding, depending on the context.
03:26
Speaker A
But if you have a lot of vertical elements, you are going to need vertical padding to balance that optical weight.
03:31
Speaker A
In this case, we have 1.25 rem padding on both sides, so the inner elements have vertical room to breathe.
03:38
Speaker A
Can you feel the tension if I decrease the padding to one rem?
03:41
Speaker A
And maybe scale it down to its original size.
03:43
Speaker A
Maybe it looks fine to you.
03:46
Speaker A
But if you have the space, use it because a little extra white space will only make things easier to read.
03:50
Speaker A
But a tighter spacing can literally hurt user experience.
03:54
Speaker A
So whenever you want to pick spacing, do not start with a smaller value like 0.5 rem and increase if needed.
04:00
Speaker A
Instead, start with a bigger value like 1.5 rem and decrease the spacing if needed.
04:05
Speaker A
Let me show you what I mean by setting the spacing between these inner elements.
04:09
Speaker A
I am going to use a bigger spacing like one rem to start.
04:12
Speaker A
This is obviously too much.
04:15
Speaker A
So let us try a lower value.
04:19
Speaker A
This is much better.
04:20
Speaker A
But the title and author are more closely related than other information.
04:25
Speaker A
So let us bring them closer.
04:29
Speaker A
Maybe more.
04:31
Speaker A
Other than that, I don't think we need to touch anything else.
04:34
Speaker A
These buttons have a one rem spacing because they belong to the same group.
04:38
Speaker A
But if you notice closely, they both have one rem horizontal padding as well.
04:44
Speaker A
So the design looks clean and optically balanced.
04:47
Speaker A
If you increase or decrease the spacing, the design will still work.
04:51
Speaker A
But it will not look balanced.
04:53
Speaker A
You have to train your eyes to notice these small design details.
04:57
Speaker A
And for me, it has always been Mobin, the sponsor of this video.
05:02
Speaker A
I use Mobin on a daily basis.
05:05
Speaker A
Like today, I was designing some cards for this video.
05:10
Speaker A
And was stuck on how to highlight the selected card.
05:14
Speaker A
So I opened Mobin and searched for selected card.
05:20
Speaker A
And just like that, I got a lot of professional and clean designs to steal.
05:26
Speaker A
I mean take inspiration from.
05:30
Speaker A
And this is just one example.
05:32
Speaker A
I cannot tell you how much influence Mobin has on my design choices.
05:38
Speaker A
I don't have to visit 10 different sites and waste hours, if not days, to come up with cool and professional design ideas.
05:45
Speaker A
Plus the features and functionality of this site are on another level.
05:50
Speaker A
And every few weeks, they add a new feature that I never knew I needed.
05:56
Speaker A
Like when I saw they added animations.
05:59
Speaker A
I thought, yeah, animations are cool.
06:01
Speaker A
But then later realized, of course, screenshots are nice, but having live animations makes it so much easier to stay on Mobin.
06:09
Speaker A
And study these by playing them on a loop.
06:11
Speaker A
Mobin is a must have tool if you want to improve your design game.
06:15
Speaker A
Go check it out, you will find the link in the description.
06:21
Speaker A
Now, let's get back to the topic.
06:24
Speaker A
And fix the spacing for this UI.
06:27
Speaker A
As you can see, the typography, colors, and icons are on point.
06:31
Speaker A
But I kept this tight spacing on purpose.
06:34
Speaker A
I kept random spacing to separate these three sections, but apart from that, every icon, text, button, and interactive element.
06:41
Speaker A
Has 0.5 rem spacing.
06:43
Speaker A
Even the padding inside these dropdowns and input fields is 0.5 rem.
06:49
Speaker A
This is obviously very bad for user experience.
06:51
Speaker A
But the design might look okay to some of you.
06:54
Speaker A
That's because of the consistency.
06:56
Speaker A
Like, even if we did not pick the right number, just because the spacing is consistent throughout, we can still make sense of what is what.
07:05
Speaker A
So the first rule of spacing is being consistent.
07:07
Speaker A
Even if the number is not right, if you stay consistent, the overall design will look okayish.
07:13
Speaker A
It might not be very user-friendly, but it will not look as ugly as you might expect.
07:18
Speaker A
Having said that, let us fix this UI.
07:20
Speaker A
I am going to start with the first section by setting a generous padding of two rem.
07:24
Speaker A
As I said earlier, we always start by setting too much spacing and decrease it if needed.
07:29
Speaker A
Now step one of picking the right spacing is to break the UI into groups.
07:33
Speaker A
This title and text are closely related, so they belong to group one.
07:37
Speaker A
Group two would be these options.
07:40
Speaker A
And finally, these two buttons will be group three.
07:43
Speaker A
Let's separate them by setting a gap of 1.5 rem.
07:45
Speaker A
You might ask, why this number?
07:47
Speaker A
Why not one or two rem?
07:50
Speaker A
I have been doing this thing for a while, so I just know what will work here.
07:54
Speaker A
But here is a tip, if you want to group closely related elements, use a value below one rem.
08:01
Speaker A
To separate, use something like 1.5 or two rem.
08:06
Speaker A
And one rem falls sort of in the middle, mostly used for padding and grouping buttons.
08:11
Speaker A
But this is just a small tip and not some science or design rule.
08:14
Speaker A
Spacing always depends on the context.
08:17
Speaker A
You will see what I mean in a minute.
08:19
Speaker A
Now group one looks fine to me as 0.5 rem spacing works really well with closely related elements.
08:24
Speaker A
But these elements definitely need a little more room to breathe.
08:28
Speaker A
Let's try a bigger value like one rem.
08:31
Speaker A
And see if we need to reduce that gap.
08:34
Speaker A
This is better.
08:36
Speaker A
For some of you, this might be too much.
08:38
Speaker A
But remember, we are zoomed in.
08:42
Speaker A
And a little extra spacing is always better than a little tighter.
08:47
Speaker A
Now, although we have equal spacing.
08:50
Speaker A
This section doesn't feel balanced.
08:53
Speaker A
If you notice, all these options have equal height because of these dropdowns and input field.
09:00
Speaker A
But the toggle is a bit shorter.
09:02
Speaker A
So we have to manually set a height to this option, so the spacing feels more balanced.
09:09
Speaker A
Speaking of balanced, if you remember,
09:11
Speaker A
we have already discussed optical weight and how we need a bigger horizontal padding.
09:17
Speaker A
For these elements that flow from left to right.
09:21
Speaker A
0.5 to one rem.
09:22
Speaker A
And let's change this gap to space between, so it's cleaner and easier to navigate.
09:27
Speaker A
Same thing for this main action button.
09:31
Speaker A
People expect these to be on the right.
09:35
Speaker A
And finally, apply one rem horizontal padding and gap to finish this section.
09:39
Speaker A
But now I think this two rem padding is probably a bit too much for this section.
09:44
Speaker A
So let's do 1.5 instead.
09:48
Speaker A
Better.
09:50
Speaker A
Now we can move on to these two sections.
09:52
Speaker A
I am sure, at this point, you already know the next steps.
09:57
Speaker A
First break the section into groups.
10:00
Speaker A
Then apply a bigger spacing like one rem to separate.
10:04
Speaker A
The first group is already working.
10:05
Speaker A
But these cards definitely need bigger padding.
10:08
Speaker A
And if you remember, we usually put the same outer spacing or gap as the inner spacing or padding for a better visual balance.
10:14
Speaker A
But something still feels off.
10:17
Speaker A
You see,
10:18
Speaker A
for these cards, we also need a grid on top of padding.
10:23
Speaker A
So they all have equal width.
10:25
Speaker A
You can do this with flexbox or grid.
10:28
Speaker A
Or if you really feel like it, just directly putting a fixed width.
10:32
Speaker A
Now we can move to section three.
10:34
Speaker A
But these icons feel too close to the heading.
10:37
Speaker A
So let's fix that as well.
10:39
Speaker A
Section three is super easy.
10:41
Speaker A
Just use space between instead of this 0.5 rem gap and then separate them with a bigger gap.
10:46
Speaker A
So they have some room to breathe.
10:49
Speaker A
Let's make these proper squares.
10:52
Speaker A
And fix horizontal padding for this button.
10:57
Speaker A
Then we just need to bring everything together.
11:00
Speaker A
And fix the spacing between these sections.
11:03
Speaker A
Let's try two rem.
11:07
Speaker A
And finally, let's scale it down to original size.
11:11
Speaker A
And compare it to where we started.
11:13
Speaker A
All we did is group and separate elements using the spacing system.
11:18
Speaker A
And we just use these values.
11:20
Speaker A
Two rem was used to separate these three sections.
11:24
Speaker A
So actually, we just use these three values.
11:29
Speaker A
So if you do not want to use the full system, just these three.
11:33
Speaker A
Can also work for most gaps, margins, and padding.
11:37
Speaker A
Not only that, but they also make nice round corners as well.
11:41
Speaker A
Like, if you put one rem padding and want optically balanced border radius.
11:46
Speaker A
These values work really well together.
11:48
Speaker A
But that is a whole other topic for some other video.
Topics:UI designspacingrem unitsuser experiencetypographypaddingvisual balancedesign tipsMobinscalable design

Frequently Asked Questions

Why use rem units instead of pixels for spacing?

Rem units scale with the font size, allowing spacing to adjust consistently across different screen sizes and making the UI more flexible and user-friendly.

How should I start when setting spacing in a UI?

Start with a larger spacing value like 1.5 rem and decrease it if needed, rather than starting too tight and increasing, to avoid hurting user experience.

What is the importance of inner and outer spacing in buttons?

Inner spacing between elements like icons and text should always be smaller than the outer padding to maintain visual balance and prevent the button from looking cluttered or confusing.

Get More with the Söz AI App

Transcribe recordings, audio files, and YouTube videos — with AI summaries, speaker detection, and unlimited transcriptions.

Or transcribe another YouTube video here →