Spacing Units

This guideline explains how to use spacing across ´óÏó´«Ã½ online

Contributors

  • Sareh Heidari
  • Ryan Tinsley
  • Josh Tumath
  • +2

Overview

Please Note:

Spacing units are part of the WebCore platform. Even if your product is not currently on WebCore we recommend you consider spacing units in your work to help us create a more consistent design experience across the ´óÏó´«Ã½.

Spacing UnitSize in px
1 SU*4 px
2 SU8 px
3 SU*12 px
4 SU16 px
5 SU*20 px
6 SU24 px
7 SU32 px
8 SU40 px
9 SU48 px
10 SU56 px
11 SU64 px
12 SU72 px
13 SU80 px
14 SU120 px
15 SU160 px

*Units marked with an asterisk should be used for component spacing only. The usage of these units are explained in greater detail further down the page under 'Exceptions to the rule'.

What are spacing units?

Spacing units are a simple way of applying predefined spacing dimensions to designs. By using spacing units we can create more consistent designs and simplify decision making around margins and padding - much like GEL Typography currently does for applying type sizes.

Developers at the ´óÏó´«Ã½ define space in rem (root em) units. 1 rem is normally equivalent to 16px. Rem units are especially useful for maintaining high accessibility standards as websites coded with rem units will be compatible with browser text resizing. Spacing units are great because they allow designers and developers to speak the same language whilst valuing each discipline's mother tongue, i.e. pixels for a designer and rem units for a developer.

a screen shot of a web browser's font size settings
Font size option inside a web browser

In GEL we have 15 spacing units. The majority of theses spacing units are multiples of 8px. There are however 3 exceptions to the rule which are used for component spacing only. These are shown in pink (crosshatched) in the below visual.

A diagram showing GEL spacing units from one to fifteen
Spacing units

Spacing unit basics

Here is an example of spacing units in action on the button component.

A graphic of spacing units applied to the button component. Example shown at 4x scale
Spacing units applied to the button component. Example shown at 4x scale

Spacing units apply in both the horizontal and the vertical axis, as shown.

Graphic showing horizontal and vertical Component spacing in use on the Messaging Banner Component.
Horizontal and vertical Component spacing in use on the Messaging Banner Component. Example shown at 2x scale.

One at a time

One space = One spacing unit. Designers should avoid the temptation to stack spacing units together, especially when this results in creating pixel sizes which are not specified in the spacing unit chart.

Graphic showing correct versus incorrect usage of component spacing.
Correct vs incorrect usage of component spacing. Example shown at 3x scale

Spacing units only define space

Spacing units should not be used to define any other type of measurement aside from space between elements. For example you would not use spacing units to define the size of an image, but you would use them to define the area around it.

Graphic detailing the correct implementation of spacing units applied to an image.
Correct implementation of spacing units applied to an image. Example shown at 2.5x scale

Spacing units at different breakpoints

In the same way that the GEL grid has be designed to change at responsive breakpoints. Designers can choose to flex spacing units at different breakpoints. The below example shows the same array of promos in a 320 and 600px viewport. Both designs utilise different spacing units in order to present the content in the best possible way for the screen dimensions.

Graphic showing 320px and 600px breakpoints utilising different spacing units.
320px and 600px breakpoints utilising different spacing units. Example shown at 2x scale

Exceptions to the rule

We have 3 spacing units in our table (1SU, 3SU and 5SU) which do not follow our consistent multiples of 8px pattern. We have added these to provide additional flexibility when working on tasks which require smaller measurements, such as… creating a button component or aligning an icon inside a container. These particular spacing units should not be used when making larger page layout decisions such as spacing 3 horizontal promos, or defining distance between content regions.

Spacing 3 horizontal promos. Use only multiples of 8 when spacing larger layout items.
Spacing 3 horizontal promos. Use only multiples of 8 when spacing larger layout items. Example shown at 1.75x scale

When not to use spacing units

Not all space needs to be defined by a spacing unit. CSS allows the browser to fill in the blanks for you in some instances. Elements can be aligned automatically, without the need for defined spacing units. We have illustrated this concept in the example below, where a title has been centre aligned inside a container.

Graphic showing CSS align

Tips, tricks and resources

We have updated our Sketch library to include layout and component spacing chips. Use these to help you get started with spacing units. They can also be a really useful communication tool in developer handover sessions.

Tip: Sketch plugins such as or will allow you to adjust your nudge settings to multiples of 8, making it simple to work with spacing units.

If you have any issues relating to spacing units and their usage, please contact a member of the GEL/WebCore team.