Font styles, sizes, and utilities.
There are two ways to style text with Assembly: by applying utility classes to every element, or by creating prose sections. All typographic styles can be applied individually with classes that have a .txt- prefix. Alternatively, prose sections can be used to apply sensible default styling for all the semantic elements they contain.
Classes for font size and line height, lists, block quotes, code blocks, and more.
Style text like a keyboard button.
You entered <kbd class='txt-kbd'>Flamingo</kbd>.Style subscript text: small and below the standard line.
The chemical formula of water is H<sub class='txt-sub'>2</sub>O.Style a code block.
for each
do this
end
<pre class='pre'>
<code>for each
do this
end</code>
</pre>Style text as inline code.
git checkout the repository.Make sure you <code class='txt-code'>git checkout</code> the repository.Classes for the headline text scale. Line heights are 1.3333 times font size or less. All text size classes include -mm, -ml, and -mxl variations to target screen sizes.
<div class='txt-h1'>Malesuada Pharetra Ridiculus</div>
<div class='txt-h2'>Malesuada Pharetra Ridiculus</div>
<div class='txt-h3'>Malesuada Pharetra Ridiculus</div>
<div class='txt-h4'>Malesuada Pharetra Ridiculus</div>
<div class='txt-h5'>Malesuada Pharetra Ridiculus</div>Classes for the body text scale. Line heights are 1.5 times font size or more. All text size classes include -mm, -ml, and -mxl variations to target screen sizes.
<div class='txt-xl'>Duis mollis, est non commodo luctus, nisi erat porttitor ligula, eget lacinia odio sem nec elit.</div>
<div class='txt-l'>Duis mollis, est non commodo luctus, nisi erat porttitor ligula, eget lacinia odio sem nec elit.</div>
<div class='txt-m'>Duis mollis, est non commodo luctus, nisi erat porttitor ligula, eget lacinia odio sem nec elit.</div>
<div class='txt-ms'>Duis mollis, est non commodo luctus, nisi erat porttitor ligula, eget lacinia odio sem nec elit.</div>
<div class='txt-s'>Duis mollis, est non commodo luctus, nisi erat porttitor ligula, eget lacinia odio sem nec elit.</div>
<div class='txt-xs'>Duis mollis, est non commodo luctus, nisi erat porttitor ligula, eget lacinia odio sem nec elit.</div>Style an abbreviation or acronym.
How do you feel about <abbr title='Cascading Style Sheets' class='txt-abbr'>CSS</abbr>?Style a line separating two blocks of text.
<hr class='txt-hr'>Style an unordered list. Works with any element type if the list items use the txt-li class, but you should almost always use it with a <ul> element.
<div class='txt-ul'>
<div class='txt-li'>one</div>
<div class='txt-li'>two</div>
<div class='txt-li'>three</div>
</div>Style an ordered list. This does not work (in Firefox) without semantic elements <ol> and <li>, so use those.
<ol class='txt-ol'>
<li class='txt-li'>one</li>
<li class='txt-li'>two</li>
<li class='txt-li'>three</li>
</ol>Style a block quotation.
<div class='txt-blockquote'>Donec sed odio dui. Integer posuere erat a ante venenatis dapibus posuere velit aliquet. Donec ullamcorper nulla non metus auctor fringilla.</div>Style superscript text: small and above the standard line.
Planet earth is seven years old. <sup class='txt-sup'>citation needed</sup>Single-purpose classes for styling text.
Apply Assembly's monospaced font stack.
<div class='txt-mono'>txt-mono</div>Apply a bold font weight.
<div class='txt-bold'>txt-bold</div>Apply a light font weight.
<div class='txt-light'>txt-light</div>Apply a normal font weight.
<div class='txt-normal'>txt-normal</div>Italicize text.
<div class='txt-em'>em</div>Capitalize all letters in an element.
<div class='txt-uppercase'>UpPeRcAsE</div>Lowercase all letters in an element.
<div class='txt-lowercase'>LoWeRcAsE</div>Capitalize all words in an element.
<div class='txt-capitalize'>all words are capitalized</div>Capitalize the first letter in an element.
<div class='txt-capitalize-first'>first word only is capitalized</div>Underline text.
<div class='txt-underline'>txt-underline</div>Underline text on hover.
<span class='txt-underline-on-hover'>txt-underline-on-hover</span>Strikethrough text.
<div class='txt-strike'>txt-strike</div>Prevent text from wrapping.
<div class='border border--gray w60 txt-nowrap'>
This text is too long for its container
</div>Allow text to wrap, overriding white-space: nowrap set by a component or txt-nowrap.
<div class='border border--gray w60 txt-nowrap'>
<span class='txt-wrap'>This text wraps inside its container</span>
</div>Break a word across lines only when it would overflow its container.
<div class='border border--gray w60 txt-break-word'>
Thiswordistoolongforitscontainer
</div>Truncate text to a single line contained within the width of its container, ending with an ellipsis if it overflows.
<div class='border border--gray w60 txt-truncate'>
This text is too long for its container
</div>Apply extra space between letters.
<div class='txt-spacing05'>spaced out</div>
<div class='txt-spacing2'>way spaced out</div>Apply text shadows.
<div class='txt-shadow-darken10'>ghost world</div>
<div class='txt-shadow-darken25'>ghost world</div>
<div class='txt-shadow-darken50'>ghost world</div>
<div class='txt-shadow-lighten10 bg-darken75'>ghost world</div>
<div class='txt-shadow-lighten25 bg-darken75'>ghost world</div>
<div class='txt-shadow-lighten50 bg-darken75'>ghost world</div>Control the horizontal alignment of an element's inline children.
<div class='align-l'>.align-l</div>
<div class='align-r'>.align-r</div>
<div class='align-center'>.align-center</div>Control the vertical alignment of an inline or table-cell element.
<div>
<span class='align-t inline-block h12 w12 border border--gray'></span>
<span class='align-t inline-block h60 border border--gray'>align-t</span>
</div>
<div class='mt3'>
<span class='align-middle inline-block h12 w12 border'></span>
<span class='align-middle inline-block h60 border border--gray'>align-middle</span>
</div>
<div>
<span class='align-b inline-block h12 w12 border border--gray'></span>
<span class='align-b inline-block h60 border border--gray'>align-b</span>
</div>Conveniently style large blocks of semantic markup. prose is designed to only be used when content is generated by a markdown processor and you don't have control over each element's class list.
Apply appropriate styles based on semantic markup. Supported elements are: h1, h2, h3, h4, h5, h6, p, table, small, ul, ol, a, abbr, hr, blockquote, kbd, sub, sup, code, pre, del, s, img, and video.
Cras justo odio, dapibus ac facilisis[note] in, egestas eget quam. Lorem ipsum dolor sit amet, consectetur adipiscing elit. H20 electrolitis.
<div class="prose">
<h1>Tortor Porta</h1>
<small>Aenean lacinia bibendum nulla sed consectetur. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Nullam quis risus eget urna mollis ornare vel eu leo.</small>
<hr/>
<p>Cras justo odio, dapibus ac facilisis<sup>[note]</sup> in, <a href='#'>egestas eget quam</a>. Lorem ipsum <del>dolor</del> sit amet, consectetur adipiscing elit. H<sub>2</sub>0 electrolitis.</p>
</div>Remove prose styling. Useful when you need to display, for example, a custom form inside an otherwise consistently-styled document.
Apply this class directly to the element you want to unstyle. It does not work on containers, only on the elements themselves.
Invert the coloring of textual content inside prose sections, so it is legible against dark backgrounds.
Cras justo odio, dapibus ac facilisis[note] in, egestas eget quam. Lorem ipsum dolor sit amet, consectetur adipiscing elit. H20 electrolitis.
<div class="prose prose--dark bg-gray-deep">
<h1>Tortor Porta</h1>
<small>Aenean lacinia bibendum nulla sed consectetur. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Nullam quis risus eget urna mollis ornare vel eu leo.</small>
<hr/>
<p>Cras justo odio, dapibus ac facilisis<sup>[note]</sup> in, <a href='#'>egestas eget quam</a>. Lorem ipsum <del>dolor</del> sit amet, consectetur adipiscing elit. H<sub>2</sub>0 electrolitis.</p>
</div>Define the size, shape, and content flow of your markup.
Assembly uses a 12-column CSS Grid with optional gutters.
Grids require at minimum two elements: A parent with the class grid and a child with the class col. A col spans the full row unless you add a w-1/12 to w-11/12 fraction class, which sets how many of the 12 columns it spans. Offset a col that has a width class with an ml-1/12 to ml-11/12 fraction class; other left and right margins on col are ignored inside a grid. The grid class includes *-mm, *-ml, and *-mxl variations to target screen sizes.
Align columns with the flex--*-cross flexbox classes.
<div class='grid'>
<div class='col w-1/3 border border--darken10'>one</div>
<div class='col w-1/3 border border--darken10'>two</div>
<div class='col w-1/3 border border--darken10'>three</div>
</div><div class='grid'>
<div class='col w-1/4-ml border border--darken10'>w-1/4-ml</div>
<div class='col w-3/4-ml border border--darken10'>w-3/4-ml</div>
</div>Apply column gutters to all columns in a grid by adding a grid--gut{size} modifier to the grid element. For space between rows, add a gapy{size} class. Class set includes *-mm, *-ml, and *-mxl variations to target screen sizes.
<div class='grid grid--gut12 gapy12'>
<div class='col w-1/6 border border--darken10'>w-1/6</div>
<div class='col w-1/3 border border--darken10'>w-1/3</div>
<div class='col w-1/2 border border--darken10'>w-1/2</div>
<div class='col border border--darken10'>col</div>
</div>Control the display style of elements.
Set an element's display property value. Class set includes *-mm, *-ml, and *-mxl variations to target screen sizes.
<div class="inline bg-darken10">inline</div>
<div class="block bg-darken10">block</div>
<div class="inline-block bg-darken10">inline-block</div>
<div class="none bg-darken10">none</div>Classes for basic positioning. For flexbox positioning rules, see the documentation for flexbox utilities.
Set an element's position property value. Class set includes *-mm, *-ml, and *-mxl variations to target screen sizes.
<div class="relative">
<div class="absolute bg-darken10 right">absolute</div>
<div class="relative bg-darken10">relative</div>
<div class="static bg-darken10">static</div>
<div class="sticky bg-darken10">static</div>
<!--
Fixed positioning would interfere with page
<div class="fixed bg-darken10">fixed</div>
-->
</div>Pin a positioned element against a side of its container. Positioning classes can be combined to stretch elements across the top, bottom, left, or right sides of their container. Class set includes *-mm, *-ml, and *-mxl variations to target screen sizes.
<div class="relative h60">
<div class="absolute bg-darken10 right">right</div>
<div class="absolute bg-darken10 bottom">bottom</div>
<div class="absolute bg-darken10 left">left</div>
<div class="absolute bg-darken10 top left right align-center">top left right</div>
</div>Override default stacking order by setting an element's z-index property value. Whenever possible, rely on built-in stacking order and avoid using these classes. Class set includes *-mm, *-ml, and *-mxl variations to target screen sizes.
<div class="relative h60">
<div class="absolute z5 bg-pink py6 px6">z5</div>
<div class="absolute z1 bg-blue px6 py6 mt12 ml24">z1</div>
<div class="absolute z1-neg1 bg-blue px6 py6 mt24 ml60">z-neg1</div>
</div>All margin classes fit the following pattern: m<side><size>. And all margin class sets include *-mm, *-ml, and *-mxl variations to target screen sizes.
Set auto margins on left and right. This pattern is useful for horizontally centering block elements or aligning block elements to the start or end of their container.
<div class='mx-auto w60 bg-darken10'>mx-auto</div>
<div class='ml-auto w60 bg-darken10'>ml-auto</div>
<div class='mr-auto w60 bg-darken10'>mr-auto</div>Apply margin on the top and bottom.
<div class='my24 bg-darken10'>my24</div>Apply margin on the left and right.
<div class='mx24 bg-darken10'>mx24</div>Apply margin on the top.
<div class='mt24 bg-darken10'>mt24</div>Apply margin on the right.
<div class='mr24 bg-darken10'>mr24</div>Apply percentage-based margin on the right.
<div class='flex'>
<div class='w-1/4 mr-1/2 bg-darken10'>mr-1/2</div>
<div class='w-1/4 bg-darken10'>w-1/4</div>
</div>Apply margin on the bottom.
The negative margin classes, mb-neg, can be useful for certain design patterns like underline tabs.
<div class='mb24 bg-darken10'>mb24</div>Apply margin on the left.
<div class='ml24 bg-darken10'>ml24</div>Apply percentage-based margin on the left. Inside a grid, these offset a col by the same fraction of the 12 columns; pair them with a w-* fraction class.
<div class='grid'>
<div class='col w-1/2 ml-1/2 bg-darken10'>ml-1/2</div>
</div>All padding classes fit the following pattern: m<side><size>. And all padding class sets include *-mm, *-ml, and *-mxl variations to target screen sizes.
Apply padding on the top and bottom.
<div class='py24 bg-darken10'>py24</div>Apply padding on the left and right.
<div class='px24 bg-darken10'>px24</div>Apply padding on the top.
<div class='pt24 bg-darken10'>pt24</div>Apply padding on the right.
<div class='pr24 bg-darken10 align-r'>pr24</div>Apply padding on the bottom.
<div class='pb24 bg-darken10'>pb24</div>Apply padding on the left.
<div class='pl24 bg-darken10'>pl24</div>Gap utilities fit gap{size}, gapx{size}, and gapy{size} on the padding scale. Class sets include *-mm, *-ml, and *-mxl variations to target screen sizes. Use with flex, inline-flex, or grid.
Apply gap on both axes.
<div class='flex flex--wrap gap12'>
<div class='bg-darken10 px6'>a</div>
<div class='bg-darken10 px6'>b</div>
<div class='bg-darken10 px6'>c</div>
</div>Apply column-gap (horizontal gap).
<div class='flex gapx12'>
<div class='bg-darken10 px6'>a</div>
<div class='bg-darken10 px6'>b</div>
</div>Apply row-gap (vertical gap).
<div class='flex flex--column gapy12'>
<div class='bg-darken10 px6'>a</div>
<div class='bg-darken10 px6'>b</div>
</div>All sizing classes fit the following pattern: <w|h><min|max><size> or <w|h><min|max>-full for 100%. And all sizing class sets include *-mm, *-ml, and *-mxl variations to target screen sizes.
Set an element's width.
In addition to numeric values, there are w-full and w-auto classes.
<div class='w60 bg-darken10'>w60</div>Set a percentage-based width.
<div class='grid'>
<div class='col w-1/2 bg-darken10'>w-1/2</div>
<div class='col w-1/4 bg-darken25'>w-1/4</div>
<div class='col w-1/4 bg-darken50'>w-1/4</div>
</div>Set an element's maximum width.
In addition to numeric values, there are wmax-full and wmax-none classes.
<div class='wmax6 bg-darken10'>wmax6</div>Set an element's minimum width.
In addition to numeric values, there is the wmin-full class.
<div class='inline-block wmin60 bg-darken10'>wmin60</div>Set an element's height.
In addition to numeric values, there are h-full and h-auto classes.
<div class='h24 bg-darken10'>h24</div>Set an element's maximum height.
In addition to numeric values, there are hmax-full and hmax-none classes.
<div class='hmax12 bg-darken10'>hmax12</div>Set an element's minimum height.
In addition to numeric values, there is the hmin-full class.
<div class='hmin60 bg-darken10'>hmin60</div>Set a viewport-based height.
<div class='h-viewport-1/3 bg-darken10'>h-viewport-1/3</div>Set a viewport-based max width.
<div class='hmax-viewport-1/3 h-viewport-1/2 bg-darken10'>hmax-viewport-1/3</div>Flexbox utilities. All class sets include *-mm, *-ml, and *-mxl variations to target screen sizes.
Usage must fit the following pattern:
flex or inline-flex must be on a parent container in order to use flex--* modifiers, while flex-child-* rules control children of a flex or inline-flex element.main axis is horizontal and the cross axis is vertical. The axes can be inverted with the use of flex--column.Establish an element as a flex parent. These classes allow the use of flex--* modifiers, and flex-child-* classes on children.
<div class='bg-darken10 flex'>flex</div>
<div class='bg-darken10 inline-flex'>inline-flex</div>Set the direction of the main axis to top-to-bottom (default is left-to-right).
<div class='bg-darken10 flex flex--column'>
<span>1</span>
<span>2</span>
<span>3</span>
</div>Set the direction of the main axis to bottom-to-top (default is left-to-right).
<div class='bg-darken10 flex flex--column-reverse'>
<span>1</span>
<span>2</span>
<span>3</span>
</div>Set the direction of the main axis to left-to-right (the default value of flex).
<div class='bg-darken10 flex flex--row'>
<span>1</span>
<span>2</span>
<span>3</span>
</div>Set the direction of the main axis to right-to-left (default is left-to-right).
<div class='bg-darken10 flex flex--row-reverse'>
<span>1</span>
<span>2</span>
<span>3</span>
</div>Center an element's children on the main axis.
<div class='flex flex--center-main bg-darken10'>
<div class='bg-darken10'>child</div>
</div>Center an element's children on the cross axis.
<div class='flex flex--center-cross bg-darken10 h120'>
<div class='bg-darken10'>child</div>
</div>Align an element's children to the start of the cross axis.
<div class='flex flex--start-cross h120 bg-darken10'>
<div class='bg-darken10 h42'>child</div>
<div class='bg-darken10'>child</div>
</div>Align an element's children to the start of the main axis.
<div class='flex flex--start-main bg-darken10'>
<div class='bg-darken10'>child</div>
</div>Align an element's children to the end of the cross axis.
<div class='flex flex--end-cross h120 bg-darken10'>
<div class='bg-darken10 h42'>child</div>
<div class='bg-darken10'>child</div>
</div>Align an element's children to the end of the main axis.
<div class='flex flex--end-main bg-darken10'>
<div class='bg-darken10'>child</div>
</div>Allow children to wrap. By default, they are all forced onto one line.
<div class='flex flex--wrap bg-darken10 overflow-hidden'>
<div class='bg-darken10 w600'>child</div>
<div class='bg-darken10 w600'>child</div>
</div>Stretch children to fill the parent container along the cross axis.
<div class='flex flex--stretch-cross bg-darken10 h120'>
<div class='bg-darken10'>child</div>
</div>Evenly distribute children across the line, so first child is at the start and last child is at the end.
<div class='flex flex--space-between-main bg-darken10 h120'>
<div class='bg-darken10'>child</div>
<div class='bg-darken10'>child</div>
</div>Distribute children with equal space around each item on the main axis.
<div class='flex flex--space-around-main bg-darken10'>
<div class='bg-darken10'>child</div>
<div class='bg-darken10'>child</div>
</div>Distribute children with equal space between and around items on the main axis.
<div class='flex flex--space-evenly-main bg-darken10'>
<div class='bg-darken10'>child</div>
<div class='bg-darken10'>child</div>
</div>Make a child grow to fill whatever space is available in the main axis of the parent container. This is useful when you have one or more elements of fixed width, and another element that should take up the remaining space in the row.
Typically, you will also want to apply the flex-child-no-shrink class to the element in the row with a fixed width.
<div class='flex bg-darken10'>
<div class='flex-child-no-shrink border w240'>child</div>
<div class='flex-child-grow border'>child</div>
</div>Prevent a child from shrinking below its width value.
By default, flex children (even with specified widths) will shrink as needed to accommodate sibling elements. This class prevents that default shrinkage, forcing siblings to accommodate the parent's width.
<div class='flex bg-darken10 w240'>
<div class='flex-child-no-shrink border w120'>child</div>
<div class='border w120'>child</div>
<div class='border w120'>child</div>
</div>Class set includes *-mm, *-ml, and *-mxl variations to target screen sizes.
Set aspect-ratio. aspect-auto resets it.
<div class='aspect-16/9 w-full bg-darken10'>aspect-16/9</div>Set object-fit on replaced elements such as img and video. Class set includes *-mm, *-ml, and *-mxl variations to target screen sizes.
<div class='w120 h60 bg-blue object-cover'>object-cover</div>Transform utilities use the individual rotate and scale properties so they compose. Class sets include *-mm, *-ml, and *-mxl variations to target screen sizes.
Rotate an element. Combines with scale*.
<div class='rotate45 bg-blue w60 h60'></div>Scale an element. scale100 is 1. Combines with rotate*.
<div class='scale50 bg-blue w60 h60'></div>Extra layout utilities.
Bleed utilities. Bleed classes allow an element inside a centered container to escape the container and meet the edge of the screen. When using the bleed classes, consider adding the .overflow-hidden class on a parent element to prevent horizontal overflow.
Warning: Bleeding elements will never bleed out to more than 50% of the viewport width. So you should not make an element bleed to one side unless it's already on that half of the screen.
Warning: In Firefox, children with negative margins have different layout effects than in other browsers. The bleed classes should only be used if the parent's width is stable, either because it is set or because other children determine it.
Class set includes *-mm, *-ml, and *-mxl variations to target screen sizes. These screen-size variants are best suited to adding the bleed, not removing it. Be aware of the effects of the unbleed class: it resets margin-left, margin-right, and flex-child-grow.
<div class='bg-darken10 flex flex--center-main overflow-hidden'>
<div class='w240 px12 py12 bg-darken10'>
<div class='bg-darken10 bleed-r'>Right bleed</div>
</div>
</div>Float utilities. Class set (except clearfix) includes *-mm, *-ml, and *-mxl variations to target screen sizes.
<div class='clearfix'>
<div class='fl bg-darken10'>left</div>
</div>
<div> with .clearfix </div>
<div class='fr bg-darken10'>right</div>
<div class='bg-darken10'> without .clearfix </div>
<div class='fl unfloat'>unfloat</div>Decorate elements with borders, shadows, opacity adjustments, and more.
Add borders to an element.
Add a 1px border that is the same color as the element's text. Target sides with *-t, *-r, *-b, and *-l. Class set includes *-mm, *-ml, and *-mxl variations to target screen sizes.
<div class='border'>border</div>
<div class='mt12 border-b'>border-b</div>Make a border zero pixels wide. Class set includes *-mm, *-ml, and *-mxl variations to target screen sizes.
<div class='border border-r--0'>border-r--0</div>Make a border two pixels wide.
<div class='border border--2'>border--2</div>Make a border dashed instead of solid.
<div class='border border--dash'>border--dash</div>Apply a color to a border.
<div class='border border--red'>border--red</div>Apply a border color on hover and active states.
<div class='border border--red-on-hover'>border--red-on-hover</div>
<div class='border border--red-on-active'>border--red-on-active (not active)</div>
<div class='border border--red-on-active is-active'>border--red-on-active (active)</div>Adjust the curve of an element's corners. All border classes include *-mm, *-ml, and *-mxl variations to target screen sizes.
Round the corners of elements. Target sides with *-t, *-r, *-b, *-l. Target corners with *-tl, *-tr, *-bl, *-br.
<div class='bg-blue inline-block round'>round</div>
<div class='bg-blue inline-block ml6 round-tr'>round-tr</div>Like round, but with twice the border radius.
<div class='bg-blue inline-block round-bold'>round-bold</div>
<div class='bg-blue inline-block ml6 round-tr-bold'>round-tr-bold</div>Like round, but with fully round corners.
<div class='bg-blue inline-block round-full'>round-full</div>
<div class='bg-blue inline-block ml6 round-tr-full'>round-tr-full</div>Unround the corners of elements. Target sides with *-t, *-r, *-b, *-l. Target corners with *-tl, *-tr, *-bl, *-br.
<input type='text' class='input unround' placeholder='.unround' />Apply outer shadows that add emphasis to elements or structure to layouts. Class naming follows the pattern shadow-<lighten|darken><alpha>.
Apply a box shadow.
<div class='shadow-darken25'>shadow-darken25</div>Apply a larger box shadow.
<div class='shadow-darken25-bold'>shadow-darken25-bold</div>Apply a box shadow on hover and active states.
<div class='shadow-darken25-on-hover'>shadow-darken25-on-hover</div>
<div class='shadow-darken25-on-active'>shadow-darken25-on-active (not active)</div>
<div class='shadow-darken25-on-active is-active'>shadow-darken25-on-active (active)</div>Set the style of the cursor when hovering over an element.
Set the cursor property value of an element.
<div class='cursor-pointer'>cursor-pointer</div>
<div class='cursor-crosshair'>cursor-crosshair</div>
<div class='cursor-move'>cursor-move</div>
<div class='cursor-notallowed'>cursor-notallowed</div>
<div class='cursor-grab'>cursor-grab</div>
<div class='cursor-grabbing'>cursor-grabbing</div>
<div class='cursor-col-resize'>cursor-col-resize</div>
<div class='cursor-row-resize'>cursor-row-resize</div>Dim elements, or hide them from the document flow without removing them.
Apply an opacity.
<div class='opacity25'>opacity25</div>
<div class='opacity50'>opacity50</div>
<div class='opacity100'>opacity100</div>Apply an opacity on hover and active states.
.opacity100-on-focus is also available to make an otherwise transparent element opaque on focus.
<div class='opacity25-on-hover'>opacity25-on-hover</div>
<div class='opacity25-on-active'>opacity25-on-active (inactive)</div>
<div class='opacity25-on-active is-active'>opacity25-on-active (active)</div>
<button class='opacity0 opacity100-on-focus'>opacity100-on-focus</button>Prefix any class with dark: to apply it only in dark mode, which follows the user's system color scheme unless the page overrides it. Pair it with the light class it replaces. dark: classes are only available in on-demand builds; the CDN stylesheet doesn't include them.
Set data-theme="dark" or data-theme="light" on <html> to override the system setting. Remove the attribute to follow it again. Try it with this toggle, which sets data-theme on this page:
Your styles
Saved 2 minutes ago
<div class='bg-gray-faint dark:bg-gray-dark color-gray-dark dark:color-white round px18 py18'>
<p class='txt-bold mb6'>Your styles</p>
<p class='color-gray dark:color-gray-light mb12'>Saved 2 minutes ago</p>
<button class='btn btn--blue dark:btn--green'>Publish</button>
</div>A toggle only needs to set the attribute. Set color-scheme too so native controls and scrollbars match:
function setTheme(theme) {
const root = document.documentElement;
if (theme === 'system') root.removeAttribute('data-theme');
else root.setAttribute('data-theme', theme);
root.style.colorScheme = theme === 'system' ? 'light dark' : theme;
}dark: works with component classes and their hover and active states, and combines with media query suffixes: dark:block-mm applies block on medium screens and up in dark mode.
Background and text colors. Colors include dark, light, and faint variations. Be sure to maintain a readable color contrast between background and text. Only use -faint text colors on dark backgrounds.
Apply a text color with color-{name}.
<div class='txt-s grid'>
<div class='col w-1/4 color-gray-dark'>color-gray-dark</div>
<div class='col w-1/4 color-gray-deep'>color-gray-deep</div>
<div class='col w-1/4 color-gray'>color-gray</div>
<div class='col w-1/4 color-gray-light'>color-gray-light</div>
<div class='col w-1/4 color-gray-lighter'>color-gray-lighter</div>
<div class='col w-1/4 color-gray-faint'>color-gray-faint</div>
<div class='col w-1/4 color-pink-dark'>color-pink-dark</div>
<div class='col w-1/4 color-pink-deep'>color-pink-deep</div>
<div class='col w-1/4 color-pink'>color-pink</div>
<div class='col w-1/4 color-pink-light'>color-pink-light</div>
<div class='col w-1/4 color-pink-lighter'>color-pink-lighter</div>
<div class='col w-1/4 color-pink-faint'>color-pink-faint</div>
<div class='col w-1/4 color-red-dark'>color-red-dark</div>
<div class='col w-1/4 color-red-deep'>color-red-deep</div>
<div class='col w-1/4 color-red'>color-red</div>
<div class='col w-1/4 color-red-light'>color-red-light</div>
<div class='col w-1/4 color-red-lighter'>color-red-lighter</div>
<div class='col w-1/4 color-red-faint'>color-red-faint</div>
<div class='col w-1/4 color-orange-dark'>color-orange-dark</div>
<div class='col w-1/4 color-orange-deep'>color-orange-deep</div>
<div class='col w-1/4 color-orange'>color-orange</div>
<div class='col w-1/4 color-orange-light'>color-orange-light</div>
<div class='col w-1/4 color-orange-lighter'>color-orange-lighter</div>
<div class='col w-1/4 color-orange-faint'>color-orange-faint</div>
<div class='col w-1/4 color-yellow-dark'>color-yellow-dark</div>
<div class='col w-1/4 color-yellow-deep'>color-yellow-deep</div>
<div class='col w-1/4 color-yellow'>color-yellow</div>
<div class='col w-1/4 color-yellow-light'>color-yellow-light</div>
<div class='col w-1/4 color-yellow-lighter'>color-yellow-lighter</div>
<div class='col w-1/4 color-yellow-faint'>color-yellow-faint</div>
<div class='col w-1/4 color-green-dark'>color-green-dark</div>
<div class='col w-1/4 color-green-deep'>color-green-deep</div>
<div class='col w-1/4 color-green'>color-green</div>
<div class='col w-1/4 color-green-light'>color-green-light</div>
<div class='col w-1/4 color-green-lighter'>color-green-lighter</div>
<div class='col w-1/4 color-green-faint'>color-green-faint</div>
<div class='col w-1/4 color-blue-dark'>color-blue-dark</div>
<div class='col w-1/4 color-blue-deep'>color-blue-deep</div>
<div class='col w-1/4 color-blue'>color-blue</div>
<div class='col w-1/4 color-blue-light'>color-blue-light</div>
<div class='col w-1/4 color-blue-lighter'>color-blue-lighter</div>
<div class='col w-1/4 color-blue-faint'>color-blue-faint</div>
<div class='col w-1/4 color-purple-dark'>color-purple-dark</div>
<div class='col w-1/4 color-purple-deep'>color-purple-deep</div>
<div class='col w-1/4 color-purple'>color-purple</div>
<div class='col w-1/4 color-purple-light'>color-purple-light</div>
<div class='col w-1/4 color-purple-lighter'>color-purple-lighter</div>
<div class='col w-1/4 color-purple-faint'>color-purple-faint</div>
<div class='col w-1/4 color-darken10'>color-darken10</div>
<div class='col w-1/4 color-darken25'>color-darken25</div>
<div class='col w-1/4 color-darken50'>color-darken50</div>
<div class='col w-1/4 color-darken75'>color-darken75</div>
<div class='col w-1/4 color-lighten10'>color-lighten10</div>
<div class='col w-1/4 color-lighten25'>color-lighten25</div>
<div class='col w-1/4 color-lighten50'>color-lighten50</div>
<div class='col w-1/4 color-lighten75'>color-lighten75</div>
<div class='col w-1/4 color-white'>color-white</div>
<div class='col w-1/4 color-black'>color-black</div>
<div class='col w-1/4 color-transparent'>color-transparent</div>
<div class='col w-1/4 color-text'>color-text</div>
</div>Apply a text color on hover and active states.
<div class='color-red-on-hover'>color-red-on-hover</div>
<div class='color-red-on-active'>color-red-on-active (not active)</div>
<div class='color-red-on-active is-active'>color-red-on-active (active)</div>Apply a background color with bg-{name}.
<div class='grid'>
<div class='col w-1/4 bg-gray-dark py6 px6'>bg-gray-dark</div>
<div class='col w-1/4 bg-gray-deep py6 px6'>bg-gray-deep</div>
<div class='col w-1/4 bg-gray py6 px6'>bg-gray</div>
<div class='col w-1/4 bg-gray-light py6 px6'>bg-gray-light</div>
<div class='col w-1/4 bg-gray-lighter py6 px6'>bg-gray-lighter</div>
<div class='col w-1/4 bg-gray-faint py6 px6'>bg-gray-faint</div>
<div class='col w-1/4 bg-pink-dark py6 px6'>bg-pink-dark</div>
<div class='col w-1/4 bg-pink-deep py6 px6'>bg-pink-deep</div>
<div class='col w-1/4 bg-pink py6 px6'>bg-pink</div>
<div class='col w-1/4 bg-pink-light py6 px6'>bg-pink-light</div>
<div class='col w-1/4 bg-pink-lighter py6 px6'>bg-pink-lighter</div>
<div class='col w-1/4 bg-pink-faint py6 px6'>bg-pink-faint</div>
<div class='col w-1/4 bg-red-dark py6 px6'>bg-red-dark</div>
<div class='col w-1/4 bg-red-deep py6 px6'>bg-red-deep</div>
<div class='col w-1/4 bg-red py6 px6'>bg-red</div>
<div class='col w-1/4 bg-red-light py6 px6'>bg-red-light</div>
<div class='col w-1/4 bg-red-lighter py6 px6'>bg-red-lighter</div>
<div class='col w-1/4 bg-red-faint py6 px6'>bg-red-faint</div>
<div class='col w-1/4 bg-orange-dark py6 px6'>bg-orange-dark</div>
<div class='col w-1/4 bg-orange-deep py6 px6'>bg-orange-deep</div>
<div class='col w-1/4 bg-orange py6 px6'>bg-orange</div>
<div class='col w-1/4 bg-orange-light py6 px6'>bg-orange-light</div>
<div class='col w-1/4 bg-orange-lighter py6 px6'>bg-orange-lighter</div>
<div class='col w-1/4 bg-orange-faint py6 px6'>bg-orange-faint</div>
<div class='col w-1/4 bg-yellow-dark py6 px6'>bg-yellow-dark</div>
<div class='col w-1/4 bg-yellow-deep py6 px6'>bg-yellow-deep</div>
<div class='col w-1/4 bg-yellow py6 px6'>bg-yellow</div>
<div class='col w-1/4 bg-yellow-light py6 px6'>bg-yellow-light</div>
<div class='col w-1/4 bg-yellow-lighter py6 px6'>bg-yellow-lighter</div>
<div class='col w-1/4 bg-yellow-faint py6 px6'>bg-yellow-faint</div>
<div class='col w-1/4 bg-green-dark py6 px6'>bg-green-dark</div>
<div class='col w-1/4 bg-green-deep py6 px6'>bg-green-deep</div>
<div class='col w-1/4 bg-green py6 px6'>bg-green</div>
<div class='col w-1/4 bg-green-light py6 px6'>bg-green-light</div>
<div class='col w-1/4 bg-green-lighter py6 px6'>bg-green-lighter</div>
<div class='col w-1/4 bg-green-faint py6 px6'>bg-green-faint</div>
<div class='col w-1/4 bg-blue-dark py6 px6'>bg-blue-dark</div>
<div class='col w-1/4 bg-blue-deep py6 px6'>bg-blue-deep</div>
<div class='col w-1/4 bg-blue py6 px6'>bg-blue</div>
<div class='col w-1/4 bg-blue-light py6 px6'>bg-blue-light</div>
<div class='col w-1/4 bg-blue-lighter py6 px6'>bg-blue-lighter</div>
<div class='col w-1/4 bg-blue-faint py6 px6'>bg-blue-faint</div>
<div class='col w-1/4 bg-purple-dark py6 px6'>bg-purple-dark</div>
<div class='col w-1/4 bg-purple-deep py6 px6'>bg-purple-deep</div>
<div class='col w-1/4 bg-purple py6 px6'>bg-purple</div>
<div class='col w-1/4 bg-purple-light py6 px6'>bg-purple-light</div>
<div class='col w-1/4 bg-purple-lighter py6 px6'>bg-purple-lighter</div>
<div class='col w-1/4 bg-purple-faint py6 px6'>bg-purple-faint</div>
<div class='col w-1/4 bg-darken5 py6 px6'>bg-darken5</div>
<div class='col w-1/4 bg-darken10 py6 px6'>bg-darken10</div>
<div class='col w-1/4 bg-darken25 py6 px6'>bg-darken25</div>
<div class='col w-1/4 bg-darken50 py6 px6'>bg-darken50</div>
<div class='col w-1/4 bg-darken75 py6 px6'>bg-darken75</div>
<div class='col w-1/4 bg-lighten5 py6 px6'>bg-lighten5</div>
<div class='col w-1/4 bg-lighten10 py6 px6'>bg-lighten10</div>
<div class='col w-1/4 bg-lighten25 py6 px6'>bg-lighten25</div>
<div class='col w-1/4 bg-lighten50 py6 px6'>bg-lighten50</div>
<div class='col w-1/4 bg-lighten75 py6 px6'>bg-lighten75</div>
<div class='col w-1/4 bg-white py6 px6'>bg-white</div>
<div class='col w-1/4 bg-black py6 px6'>bg-black</div>
<div class='col w-1/4 bg-transparent py6 px6'>bg-transparent</div>
</div>Apply a background color on hover and active states.
<div class='bg-darken25-on-hover'>bg-darken25-on-hover</div>
<div class='bg-darken25-on-active'>bg-darken25-on-active (not active)</div>
<div class='bg-darken25-on-active is-active'>bg-darken25-on-active (active)</div>Assembly uses an SVG icon sprite. To load the sprite, you must must include assembly.js on your page.
Please read the Icons page to learn more about the available icons and the Javascript API section of the home page to learn how to use them.
The icon class must be appled to an <svg> element. Inside the <svg>, insert a <use> element whose xlink:href attribute points to an icon loaded by assembly.js. All icons are referenced by the string #icon-{name}. By default, icons inherit size from their calculated text size. Change the size of icons by applying w{size} and h{size} classes to the svg.
Be aware that icons are block-level.
To see a list of all available icons, visit the icons page.
<svg class='icon'><use xlink:href='#icon-paint'/></svg>Although the btn class will apply button styling to any element, you should typically apply it to the <button> element. Not a <div> or <span> with a click handler, and not an <a> without an href attribute. <button> is semantically appropriate for anything with a click handler that changes the page dynamically. <button>s receive focus, handle keyboard events, can be disabled, and are fully accessible.
For actual links, you should usually use an <a> with the link class.
Apply a button style. To change the background color of a button, use a btn--{color} modifier (*-deep and *-dark colors are not available). Buttons have white text unless combined with a color-* class. Buttons have fully rounded corners unless combined with a round-* class.
<button class='btn'>Default</button>
<button class='btn btn--red'>Color</button>
<button class='btn btn--green color-yellow'>More colors</button>
<button class='btn round'>Less rounded</button>
<div class='px6 py6 bg-blue inline-block'>
<button class='btn btn--white color-blue'>Reverse</button>
</div>Modify a button so its text and borders are colored and its background transparent. The border color and text color will always match. To change the text and border color, use a btn--{color} modifier (*-deep colors are not available).
<button class='btn btn--stroke'>Default</button>
<button class='btn btn--stroke btn--red'>Color</button>
<button class='btn btn--stroke round'>Less rounded</button>
<div class='px6 py6 bg-blue inline-block'>
<button class='btn btn--stroke btn--white'>Reverse</button>
</div>Make a button small.
<button class='btn btn--s'>Small</button>Apply a darker active state to buttons by adding the is-active class.
<button class='btn is-active'>Active</button>
<button class='btn btn--red is-active'>Red and active</button>
<button class='btn btn--stroke is-active'>Active</button>
<button class='btn btn--stroke btn--red is-active'>Red and active</button>When a button has the disabled attribute, it will be styled accordingly.
<button disabled class='btn'>Disabled button</button>Create pill button groups. Pill groups must be wrapped in a inline-flex container. Every button in a pill group must have
btn classbtn--* modifiers you want (e.g. btn--stroke)btn--pill or btn--pill-stroke modifier. Use the btn--pill-stroke modifier if the buttons in the pill group are mostly stroke buttons (though active buttons can be non-stroke, if you like that)btn--pill-* modifier specifying its position (e.g. btn--pill-hc)For horizontal pills, use
inline-flex on the containerbtn btn--pill(-stroke) btn--pill-hc (center)btn btn--pill(-stroke) btn--pill-hl (left)btn btn--pill(-stroke) btn--pill-hr (right)For vertical pills, use
inline-flex flex--column on the containerbtn btn--pill(-stroke) btn--pill-vc (center)btn btn--pill(-stroke) btn--pill-vt (top)btn btn--pill(-stroke) btn--pill-vb (bottom)Pill buttons can be modified and themed in the same ways as regular buttons.
<div class="inline-flex">
<button class="btn btn--pill btn--pill-hl">Left</button>
<button class="btn btn--pill btn--pill-hc">Center</button>
<button class="btn btn--pill btn--pill-hr">Right</button>
</div>
<div class="inline-flex flex--column">
<button class="btn btn--stroke btn--pill-stroke btn--pill-vt">Top</button>
<button class="btn btn--pill-stroke btn--pill-vc is-active">Center</button>
<button class="btn btn--stroke btn--pill-stroke btn--pill-vb">Bottom</button>
</div>Create clickable, hoverable, focusable, colored text. These classes are often used for actual <a> elements with href attributes, but might prove useful for <button>s, as well, depending on semantics.
Style a link. By default, the link class turns text blue, and provides dark blue hover and active states. Change the color with a link--{color} modifier. Links are underlined when focused.
<a href='#Links' class='link'>A link</a>
<a href='#Links' class='link link--red'>A red link</a>Apply a darker active state to links by adding the is-active class.
<a href='#Links' class='link is-active'>Active</a>
<a href='#Links' class='link link--red is-active'>Red and active</a>When a form element like button includes both the link class and the disabled attribute, it will be styled accordingly. The disabled property has no visual effect on a elements.
<button href='#Links' disabled class='link'>A disabled link</button>
<button href='#Links' disabled class='link link--red'>A disabled red link</button>Styles for HTML5 input and textarea elements. All form elements fit into Assembly's 6px baseline grid.
The input class styles input types text, password, email, datetime, search, tel, url, and number. The textarea class styles the <textarea> element.
Both form elements fill the width of their container, by default. You should adjust the widths of inputs and textareas by adding w* width classes or controlling the widths of their containers, e.g. with grid classes.
Style a text input. Set the color of the border with a input--border-{color} modifier (*-dark colors are not available).
<input class='input' placeholder='default' />
<input class='input input--border-green w240' placeholder='green' />Make an input small.
<input class='input input--s' placeholder='small' />Style a textarea. Set the color of the border with a textarea--border-{color} modifier (*-deep and *-dark colors are not available).
<textarea placeholder='default' class='textarea'></textarea>
<textarea placeholder='pink' class='textarea textarea--border-pink w240'></textarea>Make a textarea extra small.
<textarea class='textarea textarea--s'>small textarea</textarea>When input and textarea elements have a disabled attribute, they will be styled accordingly.
<input disabled class='input' placeholder='disabled' />
<textarea disabled class='textarea' placeholder='disabled' value='Disabled'>Disabled text</textarea>When input and textarea elements have a readonly attribute, they will be styled accordingly.
<input readonly class='input' placeholder='basic' value='Readonly' />
<textarea readonly class='textarea' placeholder='basic' value='Disabled' >Readonly text</textarea>The select component styles the <select> element. The markup must fit the following pattern:
<div> with the select-container class.<select> element with the select class.<div> with the select-arrow class.Style a select component. Set the text and arrow color by adding a select--{color} modifier to the select element (*-dark colors are not available).
<div class='select-container'>
<select class='select'>
<option>default</option>
<option>two</option>
</select>
<div class='select-arrow'></div>
</div>
<div class='select-container'>
<select class='select select--green'>
<option>default</option>
<option>two</option>
</select>
<div class='select-arrow'></div>
</div>Make a select component small.
<div class='select-container'>
<select class='select select--s'>
<option>one</option>
<option>two</option>
</select>
<div class='select-arrow'></div>
</div>Modify a select component so that it has a border. Set the border and arrow color by adding a select--{color} modifier to the select element along with the select--stroke modifier (*-dark colors are not available). Note that the select--stroke modifier changes how the color modifier is interpreted.
<div class='select-container'>
<select class='select select--stroke'>
<option>one</option>
<option>two</option>
</select>
<div class='select-arrow'></div>
</div>
<div class='select-container mt6'>
<select class='select select--stroke select--green'>
<option>green</option>
<option>two</option>
</select>
<div class='select-arrow'></div>
</div>When the select element has the disabled attribute, the component will be styled accordingly.
<div class='select-container'>
<select disabled class='select'>
<option>one</option>
<option>two</option>
</select>
<div class='select-arrow'></div>
</div>
<div class='select-container'>
<select disabled class='select select--stroke'>
<option>one</option>
<option>two</option>
</select>
<div class='select-arrow'></div>
</div>The range class styles the <input type='range'> element. The markup must fit the following pattern:
<div> with the range class.<input type='range'> element.Style a range element.
The best way to vertically align range elements with other items on the same row is to wrap the row in a flex flex--center-cross container. For more details, read about the flexbox classes.
<div class='range'>
<input type='range' />
</div>Make a range element small.
<div class='range range--s'>
<input type='range' />
</div>When a range element has the disabled attribute, it will be styled accordingly.
<div class='range'>
<input disabled type='range' />
</div>The checkbox component styles the <input type='checkbox' /> element. The markup must fit the following pattern:
<label> with the class checkbox-container.<input type='checkbox' />. You may want to add a mr* margin-right class to separate the checkbox from its label.<div> with the class checkbox containing an <svg> with the chosen icon (usually #icon-check).Style a checkbox with a label. Change the color of the checkbox with a checkbox--{color} modifier (*-dark colors are not available). Adjust the line height of the checkbox to match a label with small text with the checkbox--s-label modifier.
<label class='checkbox-container'>
<input type='checkbox' />
<div class='checkbox mr6'>
<svg class='icon'><use xlink:href='#icon-check' /></svg>
</div>
More cats
</label>
<label class='txt-s checkbox-container ml24'>
<input type='checkbox' />
<div class='checkbox mr6 checkbox--s-label checkbox--red'>
<svg class='icon'><use xlink:href='#icon-check' /></svg>
</div>
More mice
</label>When a checkbox has the disabled attribute, it will be styled accordingly.
<label class="checkbox-container mr6">
<input disabled type='checkbox'>
<div class='checkbox'>
<svg class='icon'><use xlink:href='#icon-check' /></svg>
</div>
</label>
<label class="checkbox-container">
<input checked disabled type='checkbox'>
<div class='checkbox'>
<svg class='icon'><use xlink:href='#icon-check' /></svg>
</div>
</label>The radio component styles the <input type='radio'> element. The markup must fit the following pattern:
<label> with the class radio-container.<input type='radio'>. You may want to add a mr* margin-right class to separate the radio from its label.<div> with the class radio.Style a radio button. Change the color of the radio button with a radio--{color} modifier (*-dark colors are not available). Adjust the line height of the radio button to match a label with small text with the radio--s-label modifier.
<label class='radio-container'>
<input name='radio-basic' type='radio'>
<div class='radio mr6'></div>
Orange
</label>
<label class='txt-s ml24 radio-container'>
<input name='radio-basic' type='radio'>
<div class='radio radio--s-label radio--yellow mr6'></div>
Apple
</label>When a radio button has the disabled attribute, it will be styled accordingly.
<label class='radio-container'>
<input disabled type='radio'>
<div class='radio'></div>
</label>
<label class='radio-container'>
<input disabled checked type='radio'>
<div class='radio'></div>
</label>The switch component styles the <input type='checkbox' /> element. The markup must fit the following pattern:
<label> with the class switch-container.<input type='checkbox' /> as a direct child of the container.<div> with the class switch. It can sit anywhere inside the container, so a label can come before or after it. You may want to add a mr* or ml* margin class to separate the switch from its label.Style a switch. It is 24px tall to match small inputs like input--s. Change the background when active with a switch--{color} modifier (*-dark colors are not available). Change the color of the dot when active with a switch--dot-{color} modifier. To change the inactive track color, target your own class alongside .switch without !important so the active and disabled states still apply.
<label class='switch-container'>
<input type='checkbox' />
<div class='switch'></div>
</label>
<label class='switch-container'>
<input type='checkbox' />
<div class='switch switch--pink switch--dot-yellow mr6'></div>
Enable
</label>
<style>
.my-switch {
background-color: #f2c4a8;
}
</style>
<label class='switch-container'>
<input type='checkbox' />
<div class='switch my-switch mr6'></div>
Custom
</label>Make a switch 36px tall to match the default input height.
<label class='switch-container'>
<input type='checkbox' />
<div class='switch switch--l mr6'></div>
Really enable
</label>Make a switch 18px tall to sit alongside small text.
<label class='switch-container txt-s'>
<input type='checkbox' />
<div class='switch switch--s mr6'></div>
Barely enable
</label>When a switch has the disabled attribute, it will be styled accordingly.
<label class="switch-container mr6">
<input disabled type='checkbox'>
<div class="switch"></div>
</label>
<label class="switch-container">
<input checked disabled type='checkbox'>
<div class="switch"></div>
</label>The toggle group component styles a set of <input type=radio'> elements. The markup must fit the following pattern:
<div> around all your radio options with the class toggle-group.<label> with the class toggle-container.<input type='radio'>.<div> with the class toggle.Style a toggle group. Change the inactive toggle text color and the active toggle background color with a toggle--{color} modifier (*-dark colors are not available). Change the active label color with a toggle--active-{color} modifier (*-dark colors are not available). Change the group background color by adding a bg-{color} class to the toggle-group element.
<div class='toggle-group mr18'>
<label class='toggle-container'>
<input checked name='toggle-1' type='radio' />
<div class='toggle'>cat</div>
</label>
<label class='toggle-container'>
<input name='toggle-1' type='radio' />
<div class='toggle'>dog</div>
</label>
</div>
<div class='toggle-group bg-blue-faint'>
<label class='toggle-container'>
<input checked name='toggle-2' type='radio' />
<div class='toggle toggle--blue'>cat</div>
</label>
<label class='toggle-container'>
<input name='toggle-2' type='radio' />
<div class='toggle toggle--blue'>dog</div>
</label>
</div>Toggle labels don't wrap. To fit a group with long labels to its container, add wmax-full to the toggle-group, then either:
wmin0 to the long label's toggle-container and txt-truncate align-center py3 to its toggle. Add flex-child-no-shrink to other toggle-container elements to keep them whole.flex to each toggle-container and txt-wrap align-center h-auto hmin24 py3 to each toggle. Use hmin18 with toggle--s or hmin36 with toggle--l.<div class='w240 mb12'>
<div class='toggle-group wmax-full'>
<label class='toggle-container wmin0'>
<input checked name='toggle-truncate' type='radio' />
<div class='toggle txt-truncate align-center py3'>The quick brown fox jumped over the lazy dog</div>
</label>
<label class='toggle-container flex-child-no-shrink'>
<input name='toggle-truncate' type='radio' />
<div class='toggle'>dog</div>
</label>
</div>
</div>
<div class='w240'>
<div class='toggle-group wmax-full'>
<label class='toggle-container flex'>
<input checked name='toggle-wrap' type='radio' />
<div class='toggle txt-wrap align-center h-auto hmin24 py3'>The quick brown fox jumped over the lazy dog</div>
</label>
<label class='toggle-container flex'>
<input name='toggle-wrap' type='radio' />
<div class='toggle txt-wrap align-center h-auto hmin24 py3'>dog</div>
</label>
</div>
</div>Change the toggle height. toggle--s is 18px tall, the default toggle is 24px to match input--s, and toggle--l is 36px to match input.
<div class='toggle-group mr18'>
<label class='toggle-container'>
<input checked name='toggle-small' type='radio' />
<div class='toggle toggle--s'>mouse</div>
</label>
<label class='toggle-container'>
<input name='toggle-small' type='radio' />
<div class='toggle toggle--s'>cricket</div>
</label>
</div>
<div class='toggle-group'>
<label class='toggle-container'>
<input checked name='toggle-large' type='radio' />
<div class='toggle toggle--l'>horse</div>
</label>
<label class='toggle-container'>
<input name='toggle-large' type='radio' />
<div class='toggle toggle--l'>ox</div>
</label>
</div>When a toggle group input has the disabled attribute, it will be styled accordingly.
<div class='toggle-group'>
<label class='toggle-container'>
<input disabled name='pet' type='radio' />
<div class='toggle'>cat</div>
</label>
<label class='toggle-container'>
<input disabled checked name='pet' type='radio' />
<div class='toggle'>dog</div>
</label>
</div>Use tables to display tabular data.
Apply standard table styling.
| Malesuada Tristique Commodo | Nibh Commodo |
|---|---|
| item | item |
| item | item |
<table class='table'>
<thead>
<tr>
<th>Malesuada Tristique Commodo</th>
<th>Nibh Commodo</th>
</tr>
</thead>
<tbody>
<tr>
<td>item</td>
<td>item</td>
</tr>
<tr>
<td>item</td>
<td>item</td>
</tr>
</tbody>
</table>Invert a table's colors so it is legible against a dark background.
| Malesuada Tristique Commodo | Nibh Commodo |
|---|---|
| item | item |
| item | item |
<div class='bg-darken75 px12 py12'>
<table class='table table--dark'>
<thead>
<tr>
<th>Malesuada Tristique Commodo</th>
<th>Nibh Commodo</th>
</tr>
</thead>
<tbody>
<tr>
<td>item</td>
<td>item</td>
</tr>
<tr>
<td>item</td>
<td>item</td>
</tr>
</tbody>
</table>
</div>Force the width of all columns in a table to be determined by any designated widths of columns in the first row, independent of each cell's content. Any columns whose widths are not specified (by their top cells) will be equally distributed across the available space.
| Malesuada Tristique Commodo | Nibh Commodo | Fusce |
|---|---|---|
| Fusce | Curabitur blandit tempus porttitor. | Aenean Adipiscing |
| Donec ullamcorper nulla non metus auctor fringilla. Maecenas faucibus mollis interdum. | Maecenas sed diam eget risus varius blandit sit amet non magna. Nullam quis risus eget urna mollis ornare vel eu leo. | Cras Inceptos Purus |
<table class='table table--fixed'>
<thead>
<tr>
<th>Malesuada Tristique Commodo</th>
<th>Nibh Commodo</th>
<th class='w240'>Fusce</th>
</tr>
</thead>
<tbody>
<tr>
<td>Fusce</td>
<td>Curabitur blandit tempus porttitor.</td>
<td>Aenean Adipiscing</td>
</tr>
<tr>
<td>Donec ullamcorper nulla non metus auctor fringilla. Maecenas faucibus mollis interdum.</td>
<td>Maecenas sed diam eget risus varius blandit sit amet non magna. Nullam quis risus eget urna mollis ornare vel eu leo.</td>
<td>Cras Inceptos Purus</td>
</tr>
</tbody>
</table>Animations and animation modifiers.
Transition and reaction animations. By default, these run once for 1.5 seconds.
<div class="bg-blue inline-block mr18 w60 h60 round animation-pulse animation--infinite"></div>
<div class="bg-blue inline-block mr18 w60 h60 round animation-spin animation--infinite"></div>
<div class="bg-blue inline-block mr18 w60 h60 round animation-fade-in animation--infinite"></div>
<div class="bg-blue inline-block mr18 w60 h60 round animation-fade-out animation--infinite"></div>
<div class="bg-blue inline-block mr18 w60 h60 round animation-fade-in-out animation--infinite"></div>
<div class="bg-blue inline-block mr18 w60 h60 round animation-shake animation--infinite"></div>Sweep a highlight across an element to show it is loading or updating. Works on any background color except white. Runs infinitely for 1.5 seconds per sweep; use the speed and delay modifiers below to change it.
<div class="bg-gray-lighter round h36 mb12 animation-shimmer"></div>
<div class="bg-green round h36 mb12 animation-shimmer"></div>
<div class="bg-gray-dark round px12 py12">
<div class="bg-lighten10 round h36 animation-shimmer"></div>
</div>Animation duration modifiers. Change animation duration with an animation--speed-{seconds} modifier. Add a 1 second delay with animation--delay.
<div class="bg-blue inline-block mr18 w60 h60 round animation-spin animation--infinite animation--speed-025"></div>
<div class="bg-blue inline-block mr18 w60 h60 round animation-spin animation--infinite animation--speed-05"></div>
<div class="bg-blue inline-block mr18 w60 h60 round animation-spin animation--infinite animation--speed-1"></div>
<div class="bg-blue inline-block mr18 w60 h60 round animation-spin animation--infinite animation--speed-2"></div>
<div class="bg-blue inline-block mr18 w60 h60 round animation-spin animation--infinite animation--speed-4"></div>
<div class="bg-blue inline-block mr18 w60 h60 round animation-spin animation--infinite animation--delay"></div>Repeat an animation infinitely with a animation--infinite modifier.
<div class="bg-blue inline-block mr18 w60 h60 round animation-spin animation--infinite"></div>Create general-purpose triangle-shaped elements. Great for dialog boxes and tooltips.
Style simple small triangles.
<div class='triangle--u triangle color-blue inline-block'></div>
<div class='triangle--r triangle color-green inline-block'></div>
<div class='triangle--d triangle color-orange inline-block'></div>
<div class='triangle--l triangle color-pink inline-block'></div>Style large triangles.
<span class='triangle-l triangle-l--u color-blue inline-block'></span>
<span class='triangle-l triangle-l--r color-green inline-block'></span>
<span class='triangle-l triangle-l--d color-orange inline-block'></span>
<span class='triangle-l triangle-l--l color-pink inline-block'></span>Extra rules that come in handy.
Style scrollbars. Only works in Webkit-based browsers (Safari and Chrome). On dark backgrounds, add the scroll-styled--dark modifier.
Use in combination with overflow-auto.
<div class="scroll-styled overflow-auto h120"><div class='h240'></div></div>
<div class="scroll-styled scroll-styled--dark bg-gray-dark overflow-auto h120"><div class='h240'></div></div>Style a loading spinner. On dark backgrounds, add the loading--dark modifier. For a smaller spinner, add the loading--s modifier. Use color-* classes to apply a custom color to the spinner handle.
<div class="loading"></div>
<div class="loading loading--s"></div>
<div class="bg-gray-dark">
<div class="loading loading--dark"></div>
</div>
<div class="bg-gray">
<div class="loading color-lighten50"></div>
</div>Hide an element until its parent is hovered or contains keyboard focus.
<div class='flex flex--center-cross border border--gray-light round px12 py12'>
<span class='flex-child-grow'>Hover this row</span>
<button class='btn btn--s visible-on-parent-hover'>Edit</button>
</div>Fill an element with a checkerboard, for previewing transparent images and colors. On dark backgrounds, add the bg-canvas--dark modifier.
<div class='bg-canvas h60 mb12'></div>
<div class='bg-canvas bg-canvas--dark bg-gray-dark h60'></div>Disable touch and click events on an element and its children. Be aware that this rule does not disable keyboard events, so a user can still tab to an element and press Return to trigger its click event.
<div class='btn events-none'>You can't click this</div>Enable touch and click events on an element and its children. Use to re-enable such events inside a parent with the events-none class.
<div class='events-none'><div class='events-all'>You can click this.</div></div>Disable text selection on an element and its children. Use only in cases where accidental text selection causes user frustration.
<div class='unselectable'>You can't select this.</div>Enable text selection on an element and its children. Use to re-enable selection inside a parent with the unselectable class.
<div class='unselectable'><div class='selectable'>You can select this.</div></div>Apply a subtle animated transition when changing CSS properties on an element. See MDN's list of CSS animated properties for every property effected by this class.
<div class='bg-blue-on-hover transition'>Hover over me</div>Disable an animated transition on elements like btn that have default transitions.
<div class='btn transition-none'>transition-none</div>Always show scrollbars.
<div class='overflow-scroll'>Curabitur blandit tempus porttitor. Praesent commodo cursus magna, vel scelerisque nisl consectetur et. Etiam porta sem malesuada magna mollis euismod. Maecenas faucibus mollis interdum. Donec ullamcorper nulla non metus auctor fringilla. Nullam id dolor id nibh ultricies vehicula ut id elit.</div>Display scrollbars if content flows beyond the edge of the element.
<div class='h60 overflow-auto'>Curabitur blandit tempus porttitor. Praesent commodo cursus magna, vel scelerisque nisl consectetur et. Etiam porta sem malesuada magna mollis euismod. Maecenas faucibus mollis interdum. Donec ullamcorper nulla non metus auctor fringilla. Nullam id dolor id nibh ultricies vehicula ut id elit.</div>Hide content if it extends beyond the edge of the containing element.
<div class='h60 overflow-hidden'>Curabitur blandit tempus porttitor. Praesent commodo cursus magna, vel scelerisque nisl consectetur et. Etiam porta sem malesuada magna mollis euismod. Maecenas faucibus mollis interdum. Donec ullamcorper nulla non metus auctor fringilla. Nullam id dolor id nibh ultricies vehicula ut id elit.</div>Hide an element visually, but keep it available to screen readers.
<div class='hide-visually'>You cannot see this with your eyes.</div>
<div>There is a sentence above this that you cannot see.</div>Apply display none when rendering page for print.
<div class="none-print'>Hi, this text won't print!</div>