Designing for the web is not the same as designing for print media. Following are some guidelines to design usability and accessibility friendly web designs. When these guidelines are implemented properly, the website will score better on search engines as well.
The information below might be a bit overkill. It gives an idea of how we think a proper website should work code-wise. We understand if not everything is clear, or if you simply disagree. In that case we'd love to sit together to discuss the best way to merge our design-systems.
For easier communication between teams; it's a good practice to define and name everything. From color names and font-sizes to entire elements. We can put all this info in an online styleguide (like this example) accessible to everybody. This makes designing new pages a breeze, even if a new member joins the team. It also helps keeping the code-base small and efficient (resulting in faster pages).
When using webfonts; each weight is a webfont in itself. So Helvetica regular
, regular-italic
, light
and bold
are actually 4 fonts, which would complete the websites font list. Too many fonts make a website heavy (and thus slow, scoring lower on search engines).
Pick a default font-size for mobile and one for desktop (they could be the same). Both should be at least 16px
. All "scaling" in the website will depend on this/these "root" font-size(s)
We usually work with heading:xxs
up to heading:xl
, but other names are good as well. These font-styles will define font-family
, font-weight
, font-size
, line-height
and letter-spacing
for both mobile up to desktop. Color (and other) modifiers will be defined elsewhere.
We usually work with font-size:xs
up to font-size:xl
(where font-size:m
is the "root" page font-size, for example 16px
), but other names are good as well. These will define font-size
and line-height
for both mobile and desktop. Other modifiers (like color, alignment, font-weight, etc.) will be defined elsewhere.
We usually work with modifiers like font-weight:bold
, text-align:center
, but other names are good as well. Two different fonts for headings? You could add a modifier here like font-family:alternative
Check out some examples in the Typography section of this styleguide
Define an X amount of colors and name them. Shades of colors and alpha transparent values of colors should have their own name as well. This way we can keep colors manageable. Each color should have a "type" color as well. This "type" color is the text color whenever the (non-type) color is used as a background color. Keep contrast in mind (see contrast below).
We usually create both backgrounds, as well as colors modifiers for all available colors such as color:black
, background:white
. etc. which can be used as classes in the markup. The examples in the styleguide show the background color with the "type" color as the text color.
Make sure all important elements, such as forms, warnings, labels, buttons etc. have efficient color contrast. This is not only for people with limited or no sight; but also for viewing the website on a mobile phone in the middle of the summer when the brightness of your screen can't get bright enough due to the brightness of the sun.
Check out some examples in the Color section of this styleguide
Start thinking about what needs to be displayed on a small mobile phone (320 x 568 is still a good start). If a particular piece of content (text, image, video, interactive) is not needed on mobile to convey the message, it's also not needed on desktop sized viewports. Two news-items on mobile to save space? Then two items on desktop it is as well. This is especially helpful when users switch devices (mobile on the way home during a train ride vs continuing on the couch on a tablet).
What happens when the max-width of a design is reached (for example 1980px
wide)? Does the website keep growing? Center the design with colored areas left and right? Add a shadow behind the main design? Think about a proper maximum width for the design, but also what happens when a user spans their browser on a 2560px
wide (or even wider) screen. Below you can find two examples. (close the navigation sidebar for a better demo result)
In general; what's on top on mobile is on the left on desktop. Technically everything is possible, but extra code results in slower pages. Also keep in mind that users navigating with a keyboard expect items to focus in the order that they visually see them as well. So try to keep the order of elements the same on mobile up to desktop.
Hidden content behind a tab/slide/button might never be found by visitors. Make sure all (important) content is visible without a need of interaction. Automatic sliders aren't the solution either. A visitor quickly scanning the page for interesting headings skips the hidden content even if it goes to the next slide automatically. And sliders with elements that have different heights result in jumpy pages. In general; just display everything. Still want to show off your 240 testimonials? How aboout displaying two beside each other and add a "more testimonials" button below it? As a bonus you can hand-pick two testimonials that best represent the content on that particular page!
This text will jump around which is very annoying while reading it.
Try to read me when example is playing
This is the text that you can't read easily. This is true for all content that follows the slider above. And even if you "stop" the automatic sliding when the slider is outside the viewport, it's still highly annoying for reading when the slider is in fact in the viewport.
Our layout system is based on every-layout. They explain the rudiments quite good. We suggest at least scanning the rudiment pages and read the parts that grab your attention.
We work with the modular scale system. We suggest reading the first few paragraphs of this article (up to the Javascript parts) since our whole layout system is based on this principle. This means that the websites we build shrink and grow depending on the users browser settings. People with bad sight might have their devices set to a standard bigger font size, and when working with pixels, these settings are ignored.
As a second layer we like to make "values" grow with the browser by setting mininum and maximum values and scale between these values using the browser width. An example; a heading on mobile might have a font-size of 24px
, on desktop it might be 32px
. In our code we basically tell the browser that our heading should have a font-size of 24px
up until a certain point (for example 37,5 "units"; which will translate to 600px
when both the browser and main website font-size is set to the default 16px
), then grow in size depending on the viewport size up until another point (60 units for example) and then stay 32px
. To further demonstrate this check out the following example.
The above heading has a min value of "24px" and max value of "48px"
Spacing between grid items example
When building pages we love to work with a set of "layout-building-blocks" (see every-layout). We're using the "stack", "center", "cluster", "sidebar", "switcher" and the "grid" and we added our own "flag-object" and some options like "max" (span a maximum with based on the site with) and "shift" (when used with "max" you can shift elements to left or right).
All these layout elements do not care where they are or how wide your browser window is. Everything is calculated on the element width itself (using CSS, not JS). This make it "impossible" to design something "specific" for mobile/tablet/desktop since we never know where an element is being used and how it behaves on a certain width. Still need a button only on mobile? (there are use cases; like hiding a button on desktop that opens filters on mobile, while filters are always displayed in the sidebar on desktop for example) We can rebuild certain elements to make them dependent on the viewport instead of the element itself. These 'rebuilt' elements are less versatile but can be used whenever we exactly know where an element is being used.
With a stack element you can space elements vertically from each other, with a cluster you space items both horizontally and vertically. But not each element should be spaced the same. therefor we've got modifiers. Modifiers will make layout elements behave differently. Spacing is an example, grid item widths is another example. Preferably we work with the modular scale in here as well. As an example we can have a modifier called stack--ms:2
which uses the modular scale 2 value to space items apart.
Check out some examples in the Layout section of this styleguide
Each form element needs a label. Do not add the label inside the field itself since it will disappear when filling in the form. Always put the label in front or above the field.
What if a user forgets to fill some fields? Make sure you design a proper "error message" as well. It's even better to think about how to assist the user as much as possible ibn the first place by designing notes with a form field for the more difficult fields to understand.
Check out some examples in the Form section of this styleguide
The above information is, in a nutshell, how we like to work to create the best websites for everybody. We understand that this is a lot to take in, especially the "layout" section, and we fully understand that.
As demonstrated, the designs will never be pixel-perfect since they are depending on a lot of factors. So the make the designing phase a bit easier, here's a list of units you can use to design / size / space different elements:
Element | Calculated pixel size |
---|---|
Site width | 1184px |
Content width | 776px |
Narrow width | 572px |
Wider width | 980px |
Full width | entire browser viewport |
Mobile gutter width | 24px |
Desktop gutter width | 40px |
Modular Scale (MS) 0 | 16px |
MS -1 | 11px |
MS -2 | 7px |
MS -3 | 5px |
MS -4 | 3px |
MS 1 | 24px |
MS 2 | 36px |
MS 3 | 54px |
MS 4 | 80px |
Default grid item | 266px |
Sidebar width | 266px |
font-size-m | 16px |
font-size-s | 15px |
font-size-xs | 14px |
font-size-l | 18px |
font-size-xl | 20px |
heading-size-m | 24px <> 32px |
heading-size-s | 20px <> 24px |
heading-size-xs | 18px <> 20px |
heading-size-xxs | 16px <> 18px |
heading-size-l | 32px <> 38px |
heading-size-xl | 38px <> 40px |
The list above can easily be adjusted and extended. Just make sure everything fits in a design system :-)
Understanding something by just reading it is quite hard ;)
Below you can find a "general" styleguide where you can click around, adjust your screen size, read the accompanying information and get a better understanding of the different building blocks. I also added some buttons, cards and utilities that we love to work with. These are all "structural" meaning that the design itself can go into any direction.
The following components are currently available:
The first heading on a page should always be an <h1>
with the class heading:xl
Only one <h1>
per page is allowed.
<h2 class="heading:xl">Lorem ipsum dolor sit amet</h2>
@include heading("xl")
heading:xl
<h2 class="heading:l">Lorem ipsum dolor sit amet</h2>
@include heading("l")
heading:l
<h2 class="heading:m">Lorem ipsum dolor sit amet</h2>
@include heading("m")
heading:m
<h2 class="heading:s">Lorem ipsum dolor sit amet</h2>
@include heading("s")
heading:s
<h2 class="heading:xs">Lorem ipsum dolor sit amet</h2>
@include heading("xs")
heading:xs
Lorem ipsum dolor sit amet
<p class="font-size:xl">Lorem ipsum dolor sit amet</p>
font-size:l
Lorem ipsum dolor sit amet
<p class="font-size:l">Lorem ipsum dolor sit amet</p>
font-size:l
Lorem ipsum dolor sit amet
<p class="font-size:m">Lorem ipsum dolor sit amet</p>
font-size:m
Lorem ipsum dolor sit amet
<p class="font-size:s">Lorem ipsum dolor sit amet</p>
font-size:s
Lorem ipsum dolor sit amet
<p class="font-size:xs">Lorem ipsum dolor sit amet</p>
font-size:xs
Lorem ipsum dolor sit amet
<p class="font-weight:normal">Lorem ipsum dolor sit amet</p>
font-weight:normal
Lorem ipsum dolor sit amet
<p class="font-weight:bold">Lorem ipsum dolor sit amet</p>
font-weight:bold
Lorem ipsum dolor sit amet
<p class="text-align:center">Lorem ipsum dolor sit amet</p>
text-align:center
Lorem ipsum dolor sit amet
<p class="text-align:right">Lorem ipsum dolor sit amet</p>
text-align:right
Lorem ipsum dolor sit amet
<p class="text-align:left">Lorem ipsum dolor sit amet</p>
text-align:left
<h2 class="heading:xl balance-text">Lorem ipsum dolor sit amet consectetuer adipiscing elit.</h2>
balance-text
Lorem ipsum dolor sit amet
<p class="italic">Lorem ipsum dolor sit amet</p>
italic
Integer posuere erat a ante venenatis dapibus posuere velit aliquet. Maecenas faucibus mollis interdum. Cras justo odio, dapibus ac facilisis in, egestas eget quam. Morbi leo risus, porta ac consectetur ac, vestibulum at eros. Nullam quis risus eget urna mollis ornare vel eu leo. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Aenean eu leo quam. Pellentesque ornare sem lacinia quam venenatis vestibulum.
<p class="nowrap">Integer posuere erat a ante venenatis dapibus posuere velit aliquet. Maecenas faucibus mollis interdum. Cras justo odio, dapibus ac facilisis in, egestas eget quam. Morbi leo risus, porta ac consectetur ac, vestibulum at eros. Nullam quis risus eget urna mollis ornare vel eu leo. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Aenean eu leo quam. Pellentesque ornare sem lacinia quam venenatis vestibulum.</p>
nowrap
Integer posuere erat a ante venenatis dapibus posuere velit aliquet. Maecenas faucibus mollis interdum. Cras justo odio, dapibus ac facilisis in, egestas eget quam. Morbi leo risus, porta ac consectetur ac, vestibulum at eros. Nullam quis risus eget urna mollis ornare vel eu leo. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Aenean eu leo quam. Pellentesque ornare sem lacinia quam venenatis vestibulum.
<p class="ellipsis:2">Integer posuere erat a ante venenatis dapibus posuere velit aliquet. Maecenas faucibus mollis interdum. Cras justo odio, dapibus ac facilisis in, egestas eget quam. Morbi leo risus, porta ac consectetur ac, vestibulum at eros. Nullam quis risus eget urna mollis ornare vel eu leo. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Aenean eu leo quam. Pellentesque ornare sem lacinia quam venenatis vestibulum.</p>
ellipsis:2
On this page you can find all available colors.
Magenta backgrounds and borders are added to the styleguide only to display the otherwise invisible containers.
The "Grid" in the top bar isn't pixel perfect and only "works" when the max-site width is reached. This is by design since we rely on an elements content to define it's width.
In this "layout" section you will find everything you need to structurally layout each page. All these elements are only styled structural so no borders, backgrounds or other properties will be found here.
All direct children in this container are stacked with their own top-margin (may be different for different items).
This is the main class to use to space elements from each other.<div class="stack">
<div>Example child</div>
<div>Example child</div>
<div>Example child</div>
<div>Example child</div>
</div>
Using Modular Scale -4 for margins.
<div class="stack stack--ms:-4">
<div>Example child</div>
<div>Example child</div>
</div>
Using Modular Scale -3 for margins.
<div class="stack stack--ms:-3">
<div>Example child</div>
<div>Example child</div>
</div>
Using Modular Scale -2 for margins.
<div class="stack stack--ms:-2">
<div>Example child</div>
<div>Example child</div>
</div>
Using Modular Scale -1 for margins.
<div class="stack stack--ms:-1">
<div>Example child</div>
<div>Example child</div>
</div>
Using Modular Scale 0 for margins.
<div class="stack stack--ms:0">
<div>Example child</div>
<div>Example child</div>
</div>
Using Modular Scale 1 for margins.
<div class="stack stack--ms:1">
<div>Example child</div>
<div>Example child</div>
</div>
Using Modular Scale 2 for margins.
<div class="stack stack--ms:2">
<div>Example child</div>
<div>Example child</div>
</div>
Using Modular Scale 3 for margins.
<div class="stack stack--ms:3">
<div>Example child</div>
<div>Example child</div>
</div>
Using Modular Scale 4 for margins.
<div class="stack stack--ms:4">
<div>Example child</div>
<div>Example child</div>
</div>
Remove margins
<div class="stack stack--ms:none">
<div>Example child</div>
<div>Example child</div>
<div>Example child</div>
</div>
All direct children in this container are centered using the
$content-width
variable.
Note: Some elements can't be used as direct children (for example any inline
,
inline-block
or inline-flex
element, a .flag-object
, a
.horizontal-list
) because they won't center on larger screens. If you need one of these elements simply wrap it in a
div
for example.
<div class="stack stack--center">
<div>Example child</div>
<div>Example child</div>
<div>Example child</div>
<div class="flag-object">
<div class="flag-object__body">Note: This element is failing on desktop. Wrap it in a div for example.</div>
</div>
</div>
Makes the element as wide as the $narrow-width
variable. Use as child of a
.stack.stack--center
container.
<div class="narrow">...</div>
Makes the element as wide as the $wider-width
variable. Use as child of a
.stack.stack--center
container.
<div class="wider">...</div>
Makes the element as wide as the $site-width
variable. Use as child of a
.stack.stack--center
container.
<div class="widest">...</div>
Makes the element as wide as the parent container. Use as child of a
.stack.stack--center
container.
Use this element to span the entire site and add background colors to this div to create colored sections.
<div class="full-width">...</div>
Self centering element.
<div class="center">Example</div>
Small self centering element.
<div class="center center--size:xs">Example</div>
Children will stay neatly in a self-growing grid. All children are at least $grid-item-width
wide.
Falls back to flexbox on older browsers.
<div class="grid">
<div class="inner">
<div>Grid item</div>
<div>Grid item</div>
<div>Grid item</div>
</div>
</div>
All children are at least $grid-item-width--s
wide.
<div class="grid grid--size:s">
<div class="inner">
<div>Grid item</div>
<div>Grid item</div>
<div>Grid item</div>
</div>
</div>
All children are at least $grid-item-width--l
wide.
<div class="grid grid--size:l">
<div class="inner">
<div>Grid item</div>
<div>Grid item</div>
<div>Grid item</div>
</div>
</div>
Stacked containers on a small screen and aligned when all children are at least $grid-item-width
wide.
<div class="switcher">
<div class="inner">
<div>Switcher item</div>
<div>Switcher item</div>
<div>Switcher item</div>
<div>Switcher item</div>
</div>
</div>
Stacked containers on a small screen and aligned in a 1/2 ratio when both children are at least $grid-item-width
wide.
<div class="switcher switcher--1:2">
<div class="inner">
<div>Switcher item</div>
<div>Switcher item</div>
</div>
</div>
Stacked containers on a small screen and aligned in a 2/1 ratio when both children are at least $grid-item-width
wide.
<div class="switcher switcher--2:1">
<div class="inner">
<div>Switcher item</div>
<div>Switcher item</div>
</div>
</div>
A small size switcher.
<div class="switcher switcher--size:s">
<div class="inner">
<div>Switcher item</div>
<div>Switcher item</div>
<div>Switcher item</div>
<div>Switcher item</div>
</div>
</div>
A left sidebar. Sidebar has a "fixed" width which differs it from the switcher.
<div class="has-sidebar has-sidebar--left">
<div class="inner">
<div>The sidebar</div>
<div>The content</div>
</div>
</div>
A right sidebar. Sidebar has a "fixed" width which differs it from the switcher.
<div class="has-sidebar has-sidebar--right">
<div class="inner">
<div>The content</div>
<div>The sidebar</div>
</div>
</div>
Left & right sidebar. Sidebars have "fixed" widths which differs it from the switcher.
<div class="has-sidebar has-sidebar--both">
<div class="inner">
<div>The left sidebar</div>
<div>The content</div>
<div>The right sidebar</div>
</div>
</div>
Automatically sizing flag-object. The body
is fluid and aside
is fixed.
Make sure you define a width for fluid elements (like images) inside an aside
to avoid weird growing flag objects
<div class="flag-object">
<div class="flag-object__aside">Aside</div>
<div class="flag-object__body">Body element <br/> Multiline</div>
</div>
<div class="flag-object flag-object--scale:-2">
<div class="flag-object__aside">Aside</div>
<div class="flag-object__body">Body element</div>
</div>
<div class="flag-object flag-object--scale:-3">
<div class="flag-object__aside">Aside</div>
<div class="flag-object__body">Body element</div>
</div>
Add this modifier to vertically align all children on top instead of middle
<div class="flag-object flag-object--top">
<div class="flag-object__aside">Aside</div>
<div class="flag-object__body">Body element <br/> Multiline</div>
</div>
Add this modifier to vertically align all children on bottom instead of middle
<div class="flag-object flag-object--bottom">
<div class="flag-object__aside">Aside</div>
<div class="flag-object__body">Body element <br/> Multiline</div>
</div>
Add this modifier to keep everything aligned instead of stacked even on smaller screens
<div class="flag-object flag-object--nowrap">
<div class="flag-object__aside">Aside</div>
<div class="flag-object__body">Body</div>
</div>
Add this modifier to get an inline-flex flag-object
<div class="flag-object flag-object--inline">
<div class="flag-object__aside">Aside</div>
<div class="flag-object__body">Body</div>
</div>
Removes the 50% min-with from the "flexing" element
<div class="flag-object">
<div class="flag-object__aside">Aside</div>
<div class="flag-object__fill">This is the flag-object__fill element. This item will just grow and shrink indefinitely</div>
</div>
A cluster of elements evenly spaced both vertical as horizontal.
The cluster doesn't care what you throw at it. Just remember that it is a flexbox so each row is as tall as the tallest child.
<div class="cluster">
<div>Cluster item</div>
<div>Cluster item</div>
<a class="button" href="#">Cluster item</a>
</div>
<div class="cluster:xxs">
<div>Cluster item</div>
<div>Cluster item</div>
<a class="button" href="#">Cluster item</a>
</div>
<div class="cluster:xs">
<div>Cluster item</div>
<div>Cluster item</div>
<a class="button" href="#">Cluster item</a>
</div>
<div class="cluster:s">
<div>Cluster item</div>
<div>Cluster item</div>
<a class="button" href="#">Cluster item</a>
</div>
<div class="cluster:l">
<div>Cluster item</div>
<div>Cluster item</div>
<a class="button" href="#">Cluster item</a>
</div>
<div class="cluster cluster--nowrap">
<div>Cluster item</div>
<div>Cluster item</div>
<a class="button" href="#">Cluster item</a>
</div>
<div class="cluster cluster--inline">
<div>Cluster item</div>
<div>Cluster item</div>
<a class="button" href="#">Cluster item</a>
</div>
A cluster dividing children between the width of the parent.
<div class="cluster cluster--fill">
<div>Cluster item</div>
<div>Cluster item</div>
<a class="button" href="#">Cluster item</a>
</div>
A cluster stretching children between the width of the parent.
<div class="cluster cluster--stretch">
<div>Cluster item</div>
<div>Cluster item</div>
<a class="button" href="#">Cluster item</a>
</div>
<div class="cluster cluster--center">
<div>Cluster item</div>
<div>Cluster item</div>
<a class="button" href="#">Cluster item</a>
</div>
<div class="cluster cluster--end">
<div>Cluster item</div>
<div>Cluster item</div>
<a class="button" href="#">Cluster item</a>
</div>
Spanning max 3 columns based on 12 columns and based on the $site-width
variable, not based on
100% design width.
For example: max:6
is only 50% wide when the viewport has reached the $site-width
width. When the screen is smaller, max:6
stays half the wifth of the $site-width
variable.
<div class="max:3">Example</div>
<div class="max:4">Example</div>
<div class="max:5">Example</div>
<div class="max:6">Example</div>
<div class="max:8">Example</div>
<div class="max:10">Example</div>
$narrow-width
variable
<div class="max:narrow">Example</div>
$content-width
variable
<div class="max:content">Example</div>
<div class="max:4 max--center">Example</div>
<div class="shift:3">Example</div>
Only use the button class for actual <button>
or <a>
elements.
<a href="#" class="button button--example1"><span class="button__text">Example</span></a>
<a href="#" class="button button--example2"><span class="button__text">Example</span></a>
<a href="#" class="button button--example1 button--block"><span class="button__text">Example</span></a>
<a href="#" class="button button--example1 button--l"><span class="button__text">Example</span></a>
When multiple cards are used in one container. Make sure to make the parent + cards an ul > li
. If no other container is available (like a grid or switcher for example) you can use .cards
as a class for the parent ul
Some card content in the card body
Some card content in the card body
<li class="card" data-card>
<div class="card__image">
<div class="ratio:5:2">
Image
</div>
</div>
<div class="card__body">
<div class="card__content">
<h3 class="heading:s">
<a href="#" data-card-link>
A card heading
</a>
</h3>
<p>Some card content in the card body</p>
</div>
</div>
</li>
Some card content in the card body
<li class="card card--aligned" data-card>
<div class="card__image">
<div class="ratio:5:2">
Image
</div>
</div>
<div class="card__body">
<div class="card__content">
<h3 class="heading:s">
<a href="#" data-card-link>
A card heading
</a>
</h3>
<p>Some card content in the card body</p>
</div>
</div>
</li>
Basic form elements to use.
<div class="form__group"><em>Form elements here</em></div>
<div class="form__group">
<label class="form__label" for="input-text-example">Field label</label>
<input class="form__input" id="input-text-example" name="input-text-example" type="text" />
</div>
<div class="form__group">
<label class="form__label" for="select-example">Field label</label>
<div class="custom-select">
<select id="example3" name="select-example">
<option value="option1">Option 1</option>
<option value="option2">Option 2</option>
<option value="option3">Option 3</option>
<option value="option4">Option 4</option>
</select>
</div>
</div>
<div class="form__group">
<label class="form__label" for="textarea-example">Field label</label>
<div class="form__hint" id="textarea-example-hint">Explanation for textarea</div>
<textarea class="form__input" rows="6" id="textarea-example" name="textarea-example" aria-describedby="textarea-example-hint"></textarea>
</div>
<div class="form__group">
<fieldset aria-describedby="checkbox-example-hint">
<legend class="heading:xs">Checkbox options</legend>
<div class="form__hint" id="checkbox-example-hint">Explanation for options</div>
<div class="multiple-choice">
<input id="checkbox-example-1" name="checkbox-example" type="checkbox" value="option1">
<label for="checkbox-example-1">Option 1</label>
</div>
<div class="multiple-choice">
<input id="checkbox-example-2" name="checkbox-example" type="checkbox" value="option2">
<label for="checkbox-example-2">Option 2</label>
</div>
<div class="multiple-choice">
<input id="checkbox-example-3" name="checkbox-example" type="checkbox" value="option3">
<label for="checkbox-example-3">Option 3</label>
</div>
</fieldset>
</div>
<div class="form__group">
<fieldset aria-describedby="radio-example-hint">
<legend class="heading:xs">Radio options</legend>
<span class="form__hint" id="radio-example-hint">Explanation for options</span>
<div class="multiple-choice">
<input id="radio-example-1" name="radio-example" type="radio" value="option1">
<label for="radio-example-1">Option 1</label>
</div>
<div class="multiple-choice">
<input id="radio-example-2" name="radio-example" type="radio" value="option2">
<label for="radio-example-2">Option 2</label>
</div>
<div class="multiple-choice">
<input id="radio-example-3" name="radio-example" type="radio" value="option3">
<label for="radio-example-3">Option 3</label>
</div>
</fieldset>
</div>
<fieldset class="form__group" aria-describedby="group-example-hint">
<legend class="heading:xs">Input group</legend>
<div class="form__hint" id="group-example-hint">Explanation</div>
<div class="form__input-group">
<input class="form__input" id="group-example-input" name="group-example-input" type="text" />
<button class="button" type="button">Button</button>
</div>
</fieldset>
<div class="form__group form__group--error">
<label class="form__label" for="input-error-example">Field label</label>
<span id="passport-issued-error" class="form__error">
<span class="visually:hidden">Error:</span> Some error message
</span>
<input class="form__input" id="input-error-example" name="input-text-example" type="text" aria-describedby="national-insurance-number-error" />
</div>
Classes that mostly do just one thing.
margin-top:auto
margin-top:none
<div class="margin-top:ms-4">Example</div>
margin-top:ms-4
<div class="margin-top:ms-3">Example</div>
margin-top:ms-3
<div class="margin-top:ms-2">Example</div>
margin-top:ms-2
<div class="margin-top:ms-1">Example</div>
margin-top:ms-1
<div class="margin-top:ms0">Example</div>
margin-top:ms0
<div class="margin-top:ms1">Example</div>
margin-top:ms1
<div class="margin-top:ms2">Example</div>
margin-top:ms2
<div class="margin-top:ms3">Example</div>
margin-top:ms3
<div class="margin-top:ms4">Example</div>
margin-top:ms4
<div class="padding">Example</div>
padding
padding-top:none
<div class="padding-top:ms-4">Example</div>
padding-top:ms-4
<div class="padding-top:ms-3">Example</div>
padding-top:ms-3
<div class="padding-top:ms-2">Example</div>
padding-top:ms-2
<div class="padding-top:ms-1">Example</div>
padding-top:ms-1
<div class="padding-top:ms0">Example</div>
padding-top:ms0
<div class="padding-top:ms1">Example</div>
padding-top:ms1
<div class="padding-top:ms2">Example</div>
padding-top:ms2
<div class="padding-top:ms3">Example</div>
padding-top:ms3
<div class="padding-top:ms4">Example</div>
padding-top:ms4
position: relative
position:relative
position: absolute
position:absolute
position: static
position:static
z-index: 1
z-index:1
z-index: 2
z-index:2
z-index: 3
z-index:3
<div class="ratio:16:9">Example</div>
ratio:16:9
<div class="ratio:5:2">Example</div>
ratio:5:2
<div class="ratio:4:3">Example</div>
ratio:4:3
<div class="ratio:3:2">Example</div>
ratio:3:2
<div class="ratio:1:1">Example</div>
ratio:1:1
visually:hidden
overflow:hidden