Structure

Global font size

Global font size is an important variable in how structure is defined in Lens. Lens uses a global font size of 18px. Many ingredients use the global font size to control elements of their structure. Padding, margins, and spacing between items are often derived from the global font size.


The basic grid

Lens is built on the Foundation grid.

We are currently using Foundation version 6.3.1.

Lens page layouts combine elements of the Foundation grid and our own custom flexbox-based styles.


Core breakpoints

  • Small (0 to 640px) — Mobile devices
  • Medium (641px to 1024px) — Tablets and larger 'mobile' devices
  • Large (1025px and up) — Desktop/laptop computers
There are two other breakpoints – Xlarge (1200px to 1439px) and Xxlarge (1440px and up). However, these are considered non-core breakpoints and are not currently used in any meaningful way in Lens.

Grid examples

THE GRID STRUCTURE

Our default grid is based on the Foundation grid. Grids normally consist of a series of columns and gutters. However, Lens doesn’t use these elements of the grid in any meaningful way, relying instead on flexbox to organise content on page layouts. It can be more useful to think of the grid as consisting of a content area (where columns and gutters would normally be), surrounded by padding and margins.

All breakpoints have a content area surrounded by padding but the small and medium breakpoints do not have margins. Here, the padding acts as a margin, providing a safe zone where no content is placed.

On the large breakpoint, margins appear once the viewport becomes wider than 1200px. No matter how wide the viewport, no content items are placed inside the margins.

diagram of our basic grid on small breakpoint diagram of our basic grid on medium breakpoint diagram of our basic grid on large breakpoint

CONTENT LAYOUT - SINGLE ITEM (OFF GRID)

Content is usually laid on top of the grid along a central spine and wrapped inside a flexbox. In general, content items take up a percentage of the width of their parent container (i.e. a flexbox). The actual percentage varies depending on which breakpoint is being used and how many content items are inside a container. Single items take up more of their parent container than multiple items.

example of single content item on small breakpoint example of single content item on medium breakpoint example of single content item on large breakpoint

CONTENT LAYOUT - THREE-UP (OFF GRID)

When a flexbox contains a row of up to three content items, they will try to arrange themselves in a single line whilst respecting their width rules. If they cannot all fit onto a single line, the last item will fall onto another line.

example of three content items on small breakpoint example of three content items on medium breakpoint example of three content items on large breakpoint