Layout
Figuration includes several components and options for laying out your project, including wrapping containers, a powerful grid system, and responsive utility classes.
Contents
Containers
Containers are the most basic layout element in Figuration and are required when using the grid system. Choose from a responsive, fixed-width container (meaning its max-width
changes at each breakpoint) or fluid-width (meaning it’s 100%
wide all the time).
While containers can be nested, most layouts do not require a nested container.
Use .container
for a fixed-width container with a defined max-width
per breakpoint.
Use .container-fluid
for a full width container, spanning the entire width of the viewport.
Responsive Breakpoints
Since Figuration is developed to be mobile first, we use a handful of media queries to create sensible breakpoints for our layouts and interfaces. These breakpoints are mostly based on minimum viewport widths and allow us to scale up elements as the viewport changes.
For accessibility reasons, the Sass internally maps the pixel defined breakpoints into em
values. We assume a 16px default root font size, since this is the default for most browsers.
PX vs EM Controversy
While this is a very opinionated topic, Figuration has chosen the em
route for greater accessibility. We believe strongly that this is the correct direction moving forward.
Some reference material - may be competing points of view:
Figuration primarily uses the following media query ranges—or breakpoints—in our source Sass files for our layout, grid system, and components.
Since we write our source CSS in Sass, all our media queries are available via Sass mixins.
We occasionally use media queries that go in the other direction (the given screen size or smaller):
Once again, these media queries are also available via Sass mixins:
There are also media queries and mixins for targeting a single segment of screen sizes using the minimum and maximum breakpoint widths.
These media queries are also available via Sass mixins:
Similarly, media queries may span multiple breakpoint widths:
The Sass mixin for targeting the same screen size range would be:
Breakpoint Nomenclature
Since Figuration is built as a mobile first framework, by default, we have created our class naming structure to not use the smallest breakpoint designation, except for a few certain instances. However, this is configurable for custom builds by overriding $enable-bp-smallest
option referenced in the Global Options settings.
Classes that apply to all breakpoints, from xs
to xl
, have no breakpoint abbreviation in them. This is because those classes are applied from min-width: 0
and up, and thus are not bound by a media query. The remaining breakpoints, however, do include a breakpoint abbreviation.
Building from the base component or utility name, most classes are named using the format .base-{direction}-{dimension}
for xs
and .base-{breakpoint}-{direction}-{dimension}
for sm
, md
, lg
, and xl
. In the case of some utilites that have abbreviated names, such as the spacing utilities, the format is .abbr{direction}-{breakpoint}-{dimension}
.
The only special case is where there are *-up
or *-down
variants for certain components or classes, the breakpoint designation. Only then is the minimum breakpoint designation used in the class name.
A quick example using some of Figuration’s Typography utility classes.
Right aligned text on all viewport sizes. (No xs
class designation!)
Right aligned text on viewports sized SM (small) or wider.
Right aligned text on viewports sized MD (medium) or wider.
Right aligned text on viewports sized LG (large) or wider.
Right aligned text on viewports sized XL (extra-large) or wider.
Z-index
Several Figuration components utilize z-index
, the CSS property that helps control layout by providing a third axis to arrange content. We utilize a default z-index scale in Figuration that’s been designed to properly layer navigation, tooltips and popovers, modals, and more.
We use a defined set because of the layered components—tooltips, popovers, navbars, dropdowns, modals—so they remain consistent in terms of behavior.
Customizing these values is most likely not needed, and we don’t recommend adjusting the values. However, if you change one, you will need to review and possibly update all of the other values.
Background elements—like the backdrops that allow click-dismissing—tend to reside on a lower z-index
s, while navigation and popovers utilize higher z-index
s to ensure they overlay surrounding content. Modals get a higher z-index so they are placed above popover/tooltip items, in the case that one or more of those items is held open.
To handle overlapping borders within components (e.g., buttons and inputs in input groups), we use low single digit z-index
values of 1
, 2
, and 3
for default, hover, and active states. On hover/focus/active, we bring a particular element to the forefront with a higher z-index
value to show their border over the sibling elements.