Layout

Mechanisms of creating layouts.

Contents:

§ Centering

.text-align:center center-aligns text.

An element with class .center centers a single child element using display: grid; place-items: center.

.align-content:center vertically aligns content in the center of the alignment container. Flexbox no longer required! We also provide .align-content:end.

§ Text columns

The .textcolumns class creates multi-column text using the CSS column-width property. The column width can be set with the --col-width variable. Protip: consider using the ch unit to set column widths.

When combined with the <dl> element, missing.css will prevent orphans and widows in supported browsers. For full support, wrap pairs of <dt> and <dd> elements in a <div>.

Example: Columned details list markup (partial support)
<dl class="textcolumns">
  <dt>Term 1
  <dd>This is an explanation of the first term.
  <!-- ... -->
</dl>

Term 1
This is an explanation of the first term.
Term 2
This is an explanation of the second term.
Term 3
This is an explanation of the third term, and missing.css will prevent it from being split if the browser supports it.
Term 4
This is an explanation of the fourth term.
Example: Columned details list markup (full support)
<dl class="textcolumns">
  <div>
  <dt>Term 1
  <dd>This is an explanation of the first term, and missing.css will make sure it doesn't get split from its sibling `<dt>` tag.
  </div>
  <!-- ... -->
</dl>

Term 1
This is an explanation of the first term.
Term 2
This is an explanation of the second term.
Term 3
This is an explanation of the third term, and missing.css will prevent it from being split in all supported browsers.
Term 4
This is an explanation of the fourth term.

§ Flow gap

The .flow-gap class adds vertical margins between its children.

§ Full-size

Add the .fullbleed class to make an element go outside its container and span the whole width of the viewport.

The .fullscreen class will size an element to fill the screen.

These classes will not work on flex children (e.g. children of .flex-row, .flex-column, or .flex-switch containers).

§ Layout utilities

Add some padding with .padding, or a margin with .margin. The amount of margin or padding is determined by the density utilities.

Add padding or margin in specific axes with the following classes.

Automatic margin is provided with the following:

To remove padding or margin, use one of the following classes:

Make an element full-width with the .width:100% class. Similarly with .height:100%. Logical variants .inline-size:100% and .block-size:100% are also available.

§ Border utilities

Add a border with .border; you can target specific axes with these classes:

Borders can be removed by using .border:none or one of the following classes:


The .nested-list class removes extraneous margins in nested lists. Deprecated: Will be removed in version 2.0. In the future, nested lists will not have margins by default. You can add them back in using <li><p> as needed.

Example: Nested list markup
<div class="flex-switch">
  <div>
    <strong>Regular list</strong>
    <ul><li>Items
        <ul><li>Item 1
            <li>Item 2</ul>
        <li>Widgets
        <ul><li>Widget 1
            <li>Widget 2</ul>