Typography
Simple and easily customized typography for headings, body text, lists, and more.
Global Settings
Figuration sets basic global display, typography, and link styles. For even more control, check out the utility classes.
- Use a native font stack that selects the best
font-family
for each OS and device. - Use the
$font-family-base
,$font-size-base
, and$line-height-base
attributes as our typographic base applied to the<body>
. - Use
$font-size-base
to scale the font size of text across all components. - Convert all
font-size
CSS rules torem
units, assuming the typical browser default of1rem
=16px
through the use of ourfont-size()
Sass mixin. While highly opinionated, Figuration believes, this offers better accessibility than usingpx
to define font sizes. - Set the global link color via
$link-color
and apply link underlines only on:hover
. - Use
$body-bg
to set abackground-color
on the<body>
(#fff
by default).
These styles can be found within _reboot.scss
, and the global variables are defined in _settings.scss
. Make sure to set $font-size-base
using rem
units.
Headings
All HTML headings, <h1>
through <h6>
, are available.
h1. Example heading
h2. Example heading
h3. Example heading
h4. Example heading
h5. Example heading
h6. Example heading
<h1>h1. Example heading</h1>
<h2>h2. Example heading</h2>
<h3>h3. Example heading</h3>
<h4>h4. Example heading</h4>
<h5>h5. Example heading</h5>
<h6>h6. Example heading</h6>
.h1
through .h6
classes are also available, for when you want to match the font styling of a heading but cannot use the associated HTML element.
h1. Example heading
h2. Example heading
h3. Example heading
h4. Example heading
h5. Example heading
h6. Example heading
<p class="h1">h1. Example heading</p>
<p class="h2">h2. Example heading</p>
<p class="h3">h3. Example heading</p>
<p class="h4">h4. Example heading</p>
<p class="h5">h5. Example heading</p>
<p class="h6">h6. Example heading</p>
Customizing Headings
Create lighter, secondary text in any heading with a generic <small>
tag or the .small
class.
You can also use the included utility classes to recolor the secondary text.
Fancy display heading With secondary text
Fancy display heading With secondary text
<h3>
Fancy display heading
<small class="text-muted">With secondary text</small>
</h3>
<h3>
Fancy display heading
<small class="text-info">With secondary text</small>
</h3>
Lead
Make a paragraph stand out by adding .lead
.
Vivamus sagittis lacus vel augue laoreet rutrum faucibus dolor auctor. Duis mollis, est non commodo luctus.
<p class="lead">
Vivamus sagittis lacus vel augue laoreet rutrum faucibus dolor auctor. Duis mollis, est non commodo luctus.
</p>
Inline Text Elements
The exmple below shows inline HTML5 tags that are used to provide semantic meaning to text.
You can use the mark tag to highlight text.
This line of text is meant to be treated as deleted text.
This line of text is meant to be treated as no longer accurate.
This line of text is meant to be treated as an addition to the document.
This line of text will render as underlined.
This line of text is meant to be treated as fine print.
This line rendered as bold text.
This line rendered as italicized text.
<p>You can use the mark tag to <mark>highlight</mark> text.</p>
<p><del>This line of text is meant to be treated as deleted text.</del></p>
<p><s>This line of text is meant to be treated as no longer accurate.</s></p>
<p><ins>This line of text is meant to be treated as an addition to the document.</ins></p>
<p><u>This line of text will render as underlined.</u></p>
<p><small>This line of text is meant to be treated as fine print.</small></p>
<p><strong>This line rendered as bold text.</strong></p>
<p><em>This line rendered as italicized text.</em></p>
While not shown above, feel free to use <b>
and <i>
in HTML5. <b>
is meant to highlight words or phrases without conveying additional importance while <i>
is mostly for voice, technical terms, etc.
Whereas:
<mark>
represents text which is marked or highlighted for reference or notation purposes.<small>
represents side-comments and small print, like copyright and legal text.<u>
represents a span of inline text which should be rendered in a way that indicates that it has a non-textual annotation.<s>
represents an element that is no longer relevant or no longer accurate.
If you only want to visually style your text, you should use the following classes instead:
.mark
will apply the same visual styles as<mark>
..small
will apply the same visual styles as<small>
..text-decoration-underline
will apply the same visual styles as<u>
..text-decoration-line-through
will apply the same visual styles as<s>
.
Text Utilities
Change text alignment, transform, style, weight, and color with our text utilities.
Abbreviations
Stylized implementation of HTML's <abbr>
element for abbreviations and acronyms to show the expanded version on hover. Abbreviations with a title
attribute have a default underline and gain a help cursor to provide additional context on hover and to users of assistive technologies.
Add .initialism
to an abbreviation for a slightly smaller font-size.
attr
HTML
<p><abbr title="attribute">attr</abbr></p>
<p><abbr title="HyperText Markup Language" class="initialism">HTML</abbr></p>
Blockquotes
For quoting blocks of content from another source within your document. Wrap <blockquote class="blockquote">
around any HTML as the quote.
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer posuere erat a ante.
<blockquote class="blockquote">
<p class="mb-0">Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer posuere erat a ante.</p>
</blockquote>
Naming a Source
Add a <footer class="blockquote-footer">
for identifying the source. Wrap the name of the source work in <cite>
.
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer posuere erat a ante.
<blockquote class="blockquote">
<p class="mb-0">Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer posuere erat a ante.</p>
<footer class="blockquote-footer">Someone famous in <cite title="Source Title">Source Title</cite></footer>
</blockquote>
Alignment
Use text alignment utilities to alter the layout of the blockquote.
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer posuere erat a ante.
<blockquote class="blockquote text-center">
<p class="mb-0">Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer posuere erat a ante.</p>
<footer class="blockquote-footer">Someone famous in <cite title="Source Title">Source Title</cite></footer>
</blockquote>
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer posuere erat a ante.
<blockquote class="blockquote text-end">
<p class="mb-0">Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer posuere erat a ante.</p>
<footer class="blockquote-footer">Someone famous in <cite title="Source Title">Source Title</cite></footer>
</blockquote>
Lists
See the rebooted list styles for the default layouts.
Unstyled
Remove the default list-style
and left margin on list items (immediate children only). This only applies to immediate children list items, meaning you will need to add the class for any nested lists as well.
- Unstyled List Item
- Unstyled List Item
- Nested List Item
- Nested List Item
- Unstyled List Item
<ul class="list-unstyled">
<li>Unstyled List Item</li>
<li>Unstyled List Item
<ul>
<li>Nested List Item</li>
<li>Nested List Item</li>
</ul>
</li>
<li>Unstyled List Item</li>
</ul>
Styled
Even more layout and style options are available for lists with Figuration's list component. This component includes indented unstyled lists, stylized bulleted and ordered lists, horizontal lists, and lists with dividers between items.
Description List Alignment
Align terms and descriptions horizontally by using our grid system's predefined classes (or semantic mixins). For longer terms, you can optionally add a .text-truncate
class to truncate the text with an ellipsis.
- Description lists
- A description list is perfect for defining terms.
- Euismod
- Vestibulum id ligula porta felis euismod semper eget lacinia odio sem nec elit.
- Donec id elit non mi porta gravida at eget metus.
- Malesuada porta
- Etiam porta sem malesuada magna mollis euismod.
- Truncated term is truncated
- Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus.
- Nesting
-
- Nested definition list
- Aenean posuere, tortor sed cursus feugiat, nunc augue blandit nunc.
<dl class="row">
<dt class="col-sm-3">Description lists</dt>
<dd class="col-sm-9">A description list is perfect for defining terms.</dd>
<dt class="col-sm-3">Euismod</dt>
<dd class="col-sm-9">Vestibulum id ligula porta felis euismod semper eget lacinia odio sem nec elit.</dd>
<dd class="col-sm-9 offset-sm-3">Donec id elit non mi porta gravida at eget metus.</dd>
<dt class="col-sm-3">Malesuada porta</dt>
<dd class="col-sm-9">Etiam porta sem malesuada magna mollis euismod.</dd>
<dt class="col-sm-3 text-truncate">Truncated term is truncated</dt>
<dd class="col-sm-9">Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus.</dd>
<dt class="col-sm-3">Nesting</dt>
<dd class="col-sm-9">
<dl class="row">
<dt class="col-sm-4">Nested definition list</dt>
<dd class="col-sm-8">Aenean posuere, tortor sed cursus feugiat, nunc augue blandit nunc.</dd>
</dl>
</dd>
</dl>
Responsive Typography
Responsive typography refers to scaling an element's font-size
within a series of media queries.
Figuration, by default, does not have responsive typography enabled. However, we have included two different methods to enable this functionality.
- Fluid sizing based on the dimensions of the viewport. Based on the Responsive font-size mixin by Martijn Cuppens.
- Scaled sizing is scaling based on current responsive breakpoint.
See the Global Options on how the enable either method. Note that only one of these methods can be enabled at a time.
Benefits of using Figuration's responsive typography options include:
- Font sizes will adjust with the size of the device, which can help reduce the chance of overflow for long words.
- Font sizes of text elements will always remain in relation to one another.
- The minimum font size (configuration setting) will prevent the font size from becoming too small so readability can be assured.
- Does not use the
font-size
of the<html>
element, and outputs sizes inrem
units, allowing for a greater level of accessibility for users who change the default font size of their browser.
Possible drawbacks include:
- Can generate a large amount of CSS. Enabling the
$responsive-font-size-generate-static
setting will generate a large amount of the CSS. Compressing the CSS, with gzip or other methods, will reduce the CSS file size impact due to the large amount of repeating strings.
Common Settings
Name | Type | Default | Description |
---|---|---|---|
$responsive-font-size-minimum-size |
font size in px or rem |
1em |
Calculated font sizes will never be smaller than this size. However, you can still pass a smaller font size, but then it won't be responsively sized. For example: |
$responsive-font-size-generate-static |
boolean | false |
Generates the If you are not using these utilities, it would be worthwhile to disable this setting to stop the generation of a potentially large amount of unused CSS. |
Fluid Responsive Typography
A smooth responsive sizing of text based on the viewport dimensions, by default this is the viewport width vw
dimension. As the viewport size is reduced, font sizes are
Using Figuration's default settings, a Sass input:
.element {
@include font-size(2.5rem);
}
Will generate the CSS output:
.element,
.font-size-static .element, .element.font-size-static {
font-size: 2.5rem;
}
@media (max-width: 75em) {
.element {
font-size: calc(1.3rem + 1.6vw) ;
}
}
Settings
Name | Type | Default | Description |
---|---|---|---|
$responsive-font-size-fluid-breakpoint |
em unit breakpoint dimension |
75em | Above this breakpoint, the font size will be equal to the font size you passed to the mixin; below the breakpoint, the font size will dynamically scale. |
$responsive-font-size-fluid-factor |
integer | 5 | This value determines the strength of font size resizing. The higher $rfs-factor, the less difference there is between font sizes on small screens. The lower the factor, the less influence the responsive scaling has, which results in bigger font sizes for small screens. $responsive-font-size-fluid-factor must be greater than 1, and setting it to 1 will disable responsive scaling. |
$responsive-font-size-fluid-two-dimensional |
boolean | false | Enabling the two dimensional media queries will determine the font size based on the smallest side of the screen with vmin . This prevents the font size from changing if the device toggles between portrait and landscape mode. |
Safari Issue
There is a known issue with Safari where it does not always recalculate the value of vw in a calc()-function for font-sizes in iframes.
More information and a workaround can be found over at Martijn Cuppen's Responsive font-size mixin.
Scaled Responsive Typography
This variant of the responsive typography uses a stepped scale, making the font scale and sizing consistent across all widths of a breakpoint.
By default the font size is scaled downwards at each decreasing breakpoint level from largest to smallest.
Using Figuration's default settings, a Sass input:
.element {
@include font-size(2.5rem);
}
Will generate the CSS output:
.element {
font-size: 1.9375rem;
}
@media (min-width: 36em) {
.element {
font-size: 2.078125rem;
}
}
@media (min-width: 48em) {
.element {
font-size: 2.21875rem;
}
}
@media (min-width: 62em) {
.element {
font-size: 2.359375rem;
}
}
@media (min-width: 75em) {
.element {
font-size: 2.5rem;
}
}
.font-size-static .element, .element.font-size-static {
font-size: 2.5rem;
}
Settings
Scaled responsive typography only has one setting, $responsive-font-size-scale-factor
, a Sass map that aligns with Figuration's grid breakpoints. Each breakpoint level gets an associated scaling value. The following example shows the default settings for the scaling values.
$responsive-font-size-scale-factor: (
xs: .625,
sm: .71875,
md: .8125,
lg: .90625,
xl: 1
)
It is also possible to change the settings so font size grows as the breakpoint size increases, as shown in the following example.
$responsive-font-size-scale-factor: (
xs: 1,
sm: 1.09375,
md: 1.1875,
lg: 1.28125,
xl: 1.375
);
SASS Reference
Variables
The available Customization options, or Sass variables, that can be customized for the typography CSS styles.
Name | Type | Default | Description |
---|---|---|---|
$enable-typography |
boolean | true |
Enable the generation of the typography classes.
Smaller segements of the typography classes can be disabled with the following $enable-* variables.
|
$enable-typography-headings |
boolean | true |
Enable the generation of the <hN> headings and heading classes.
|
$enable-typography-lead |
boolean | true |
Enable the generation of the lead in typography class. |
$enable-typography-hr |
boolean | true |
Enable the generation of the reset for horizontal rules. |
$enable-typography-small |
boolean | true |
Enable the generation of CSS for the small element and associated class. |
$enable-typography-mark |
boolean | true |
Enable the generation of CSS for the mark element and associated class. |
$enable-typography-list-unstyled |
boolean | true |
Enable the generation of the unstyled list class. |
$enable-typography-initialism |
boolean | true |
Enable the generation of the initialism class. |
$enable-typography-blockquote |
boolean | true |
Enable the generation of the blockquote classes. |
$font-family-sans-serif |
string | system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", "Liberation Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji" |
Sans-serif font stack. |
$font-family-serif |
string | Georgia, "Times New Roman", Times, serif |
Serif font stack. |
$font-family-monospace |
string | Georgia, "Times New Roman", Times, serif |
Monospace font stack. |
$font-weight-lighter |
string/integer | lighter |
Lighter font weight |
$font-weight-light |
string/integer | 300 |
Light font weight |
$font-weight-normal |
string/integer | 400 |
Standard font weight |
$font-weight-bold |
string/integer | 700 |
Bold font weight |
$font-weight-bolder |
string/integer | bolder |
Bolder font weight |
$lead-font-size |
string | ($font-size-base * 1.25) |
Lead in font size. |
$lead-font-weight |
string | inherit |
Lead in font weight. |
$lead-line-height |
string | $line-height-base |
Lead in line height. |
$text-muted |
string | $uibase-500 |
Muted text color. |
$initialism-font-size |
string | .875em |
Initialism font size. |
$blockquote-font-size |
string | ($font-size-base * 1.1875) |
Blockquote font size. |
$blockquote-color |
string | $body-color |
Blockquote font color. |
$blockquote-footer-font-size |
string | $font-size-base |
Blockquote footer font size. |
$blockquote-footer-color |
string | $uibase-500 |
Blockquote footer text color. |
$blockquote-footer-content |
string | "\2014\00a0" (em dash and non-breaking space) |
Prefix for blockquote footer. |
Mixins
No mixins available.