Text
Documentation and examples for common text utilities to control alignment, wrapping, weight, and more.
On this page
Text alignment
Easily realign text to components with text alignment classes. For start, end, and center alignment, responsive classes are available that use the same viewport width breakpoints as the grid system.
.ms-{breakpoint}-auto
(respectively .mx-{breakpoint}-auto
) in addition of .text-{breakpoint}-end
(respectively .text-{breakpoint}-center
) in these cases.
Start aligned text on all viewport sizes.
Center aligned text on all viewport sizes.
End aligned text on all viewport sizes.
End aligned text on viewports sized XS (x-small) or wider.
End aligned text on viewports sized SM (small) or wider.
End aligned text on viewports sized MD (medium) or wider.
End aligned text on viewports sized LG (large) or wider.
End aligned text on viewports sized XL (x-large) or wider.
End aligned text on viewports sized 2XL (2x-large) or wider.
End aligned text on viewports sized 3XL (3x-large) or wider.
<p class="text-start">Start aligned text on all viewport sizes.</p>
<p class="text-center mx-auto">Center aligned text on all viewport sizes.</p>
<p class="text-end ms-auto">End aligned text on all viewport sizes.</p>
<p class="text-xs-end ms-xs-auto">End aligned text on viewports sized XS (x-small) or wider.</p>
<p class="text-sm-end ms-sm-auto">End aligned text on viewports sized SM (small) or wider.</p>
<p class="text-md-end ms-md-auto">End aligned text on viewports sized MD (medium) or wider.</p>
<p class="text-lg-end ms-lg-auto">End aligned text on viewports sized LG (large) or wider.</p>
<p class="text-xl-end ms-xl-auto">End aligned text on viewports sized XL (x-large) or wider.</p>
<p class="text-2xl-end ms-2xl-auto">End aligned text on viewports sized 2XL (2x-large) or wider.</p>
<p class="text-3xl-end ms-3xl-auto">End aligned text on viewports sized 3XL (3x-large) or wider.</p>
Text wrapping and overflow
Wrap text with a .text-wrap
class.
<div class="badge text-bg-brand-primary text-wrap" style="width: 6rem;">
This text should wrap.
</div>
Prevent text from wrapping with a .text-nowrap
class.
<div class="text-nowrap bg-secondary border" style="width: 8rem;">
This text should overflow the parent.
</div>
Word break
Prevent long strings of text from breaking your components’ layout by using .text-break
to set word-wrap: break-word
and word-break: break-word
. We use word-wrap
instead of the more common overflow-wrap
for wider browser support, and add the deprecated word-break: break-word
to avoid issues with flex containers.
mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm
<p class="text-break">mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm</p>
.text-break
is removed from our RTL compiled CSS.
Text transform
Transform text in components with our text capitalization classes: text-lowercase
, text-uppercase
or text-capitalize
.
Lowercased text.
Uppercased text.
CapiTaliZed text.
<p class="text-lowercase">Lowercased text.</p>
<p class="text-uppercase">Uppercased text.</p>
<p class="text-capitalize">CapiTaliZed text.</p>
Note how .text-capitalize
only changes the first letter of each word, leaving the case of any other letters unaffected.
Font size
Quickly change the font-size
of text. Sizing for these utilities matches our predefined typography placeholders. Don’t forget to add one of our font-weight
utility when needed.
These classes change the font-size
but also the line-height
, the letter-spacing
and the max-width
. If you want to get rid of the max-width
, please make sure to use our .mw-none
width utility.
See the font-size
associated to classes
Font reference | Values for xl and upper |
Values from md to lg |
Values from 2xs to sm |
---|---|---|---|
Display large (.fs-dl ) |
4.5rem (72px) |
4rem (64px) |
2.5rem (40px) |
Display medium (.fs-dm ) |
3.5rem (56px) |
3rem (48px) |
2.25rem (36px) |
Display small (.fs-ds ) |
3rem (48px) |
2.5rem (40px) |
2rem (32px) |
Heading xlarge (.fs-hxl ) |
2.5rem (40px) |
2.25rem (36px) |
1.75rem (28px) |
Heading large (.fs-hl ) |
2rem (32px) |
1.75rem (28px) |
1.5rem (24px) |
Heading medium (.fs-hm ) |
1.75rem (28px) |
1.5rem (24px) |
1.25rem (20px) |
Heading small (.fs-hs ) |
1.5rem (24px) |
1.25rem (20px) |
1.125rem (18px) |
Body large (.fs-bl ) |
1.125rem (18px) |
1rem (16px) |
1rem (16px) |
Body medium (.fs-bm ) |
1rem (16px) |
.875rem (14px) |
.875rem (14px) |
Body small (.fs-bs ) |
.875rem (14px) |
.75rem (12px) |
.75rem (12px) |
Code medium (.fs-cm ) |
.875rem (14px) |
.875rem (14px) |
.875rem (14px) |
Code small (.fs-cs ) |
.75rem (12px) |
.75rem (12px) |
.75rem (12px) |
See more details about the font-size
classes
Font reference | Values for xl and upper |
Values from md to lg |
Values from 2xs to sm |
---|---|---|---|
Display large (.fs-dl ) |
|
|
|
Display medium (.fs-dm ) |
|
|
|
Display small (.fs-ds ) |
|
|
|
Heading xlarge (.fs-hxl ) |
|
|
|
Heading large (.fs-hl ) |
|
|
|
Heading medium (.fs-hm ) |
|
|
|
Heading small (.fs-hs ) |
|
|
|
Body large (.fs-bl ) |
|
|
|
Body medium (.fs-bm ) |
|
|
|
Body small (.fs-bs ) |
|
|
|
Code medium (.fs-cm ) |
|
|
|
Code small (.fs-cs ) |
|
|
|
.fs-dl text
.fs-dm text
.fs-ds text
.fs-hxl text
.fs-hl text
.fs-hm text
.fs-hs text
.fs-bl text
.fs-bm text
.fs-bs text
.fs-cm.font-monospace text
.fs-cs.font-monospace text
<p class="fs-dl">.fs-dl text</p>
<p class="fs-dm">.fs-dm text</p>
<p class="fs-ds">.fs-ds text</p>
<p class="fs-hxl">.fs-hxl text</p>
<p class="fs-hl">.fs-hl text</p>
<p class="fs-hm">.fs-hm text</p>
<p class="fs-hs">.fs-hs text</p>
<p class="fs-bl">.fs-bl text</p>
<p class="fs-bm">.fs-bm text</p>
<p class="fs-bs">.fs-bs text</p>
<p class="fs-cm font-monospace">.fs-cm.font-monospace text</p>
<p class="fs-cs font-monospace">.fs-cs.font-monospace text</p>
Customize your available font-size
s by modifying the $ouds-font-sizes
Sass map.
You can easily add an icon with your font reference using our icon helper.
Bootstrap $enable-bootstrap-compatibility: true
This part is enabled only when $enable-bootstrap-compatibility
is set to true
. Read more about Bootstrap compatibility.
Quickly change the font-size
of text. While our heading classes (e.g., .h1
โ.h6
) apply font-size
, font-weight
, and line-height
, these utilities only apply font-size
. Sizing for these utilities matches HTML’s heading elements, so as the number increases, their size decreases.
.fs-1 text
.fs-2 text
.fs-3 text
.fs-4 text
.fs-5 text
.fs-6 text
<p class="fs-1">.fs-1 text</p>
<p class="fs-2">.fs-2 text</p>
<p class="fs-3">.fs-3 text</p>
<p class="fs-4">.fs-4 text</p>
<p class="fs-5">.fs-5 text</p>
<p class="fs-6">.fs-6 text</p>
Customize your available font-size
s by modifying the $font-sizes
Sass map.
Font weight
Quickly change the font-weight
of text with these utilities. font-weight
utilities are abbreviated as .fw-*
.
Bold text.
Normal weight text.
<p class="fw-bold">Bold text.</p>
<p class="fw-normal">Normal weight text.</p>
Bootstrap $enable-bootstrap-compatibility: true
This part is enabled only when $enable-bootstrap-compatibility
is set to true
. Read more about Bootstrap compatibility.
Bold text.
Bolder weight text (relative to the parent element).
Semibold weight text.
Medium weight text.
Normal weight text.
Light weight text.
Lighter weight text (relative to the parent element).
<p class="fw-bold">Bold text.</p>
<p class="fw-bolder">Bolder weight text (relative to the parent element).</p>
<p class="fw-semibold">Semibold weight text.</p>
<p class="fw-medium">Medium weight text.</p>
<p class="fw-normal">Normal weight text.</p>
<p class="fw-light">Light weight text.</p>
<p class="fw-lighter">Lighter weight text (relative to the parent element).</p>
Line height
Change the line height with .lh-*
utilities. You need to enable Bootstrap compatibility to use these utilities since most of our font embed a proper line-height.
Bootstrap $enable-bootstrap-compatibility: true
This part is enabled only when $enable-bootstrap-compatibility
is set to true
. Read more about Bootstrap compatibility.
This is a long paragraph written to show how the line-height of an element is affected by our utilities. Classes are applied to the element itself or sometimes the parent element. These classes can be customized as needed with our utility API.
This is a long paragraph written to show how the line-height of an element is affected by our utilities. Classes are applied to the element itself or sometimes the parent element. These classes can be customized as needed with our utility API.
This is a long paragraph written to show how the line-height of an element is affected by our utilities. Classes are applied to the element itself or sometimes the parent element. These classes can be customized as needed with our utility API.
This is a long paragraph written to show how the line-height of an element is affected by our utilities. Classes are applied to the element itself or sometimes the parent element. These classes can be customized as needed with our utility API.
<p class="lh-1">This is a long paragraph written to show how the line-height of an element is affected by our utilities. Classes are applied to the element itself or sometimes the parent element. These classes can be customized as needed with our utility API.</p>
<p class="lh-sm">This is a long paragraph written to show how the line-height of an element is affected by our utilities. Classes are applied to the element itself or sometimes the parent element. These classes can be customized as needed with our utility API.</p>
<p class="lh-base">This is a long paragraph written to show how the line-height of an element is affected by our utilities. Classes are applied to the element itself or sometimes the parent element. These classes can be customized as needed with our utility API.</p>
<p class="lh-lg">This is a long paragraph written to show how the line-height of an element is affected by our utilities. Classes are applied to the element itself or sometimes the parent element. These classes can be customized as needed with our utility API.</p>
Monospace
Change a selection to our monospace font stack with .font-monospace
.
This is in monospace
<p class="font-monospace">This is in monospace</p>
Reset color
Reset a text or link’s color with .text-reset
, so that it inherits the color from its parent.
Secondary body text with a reset link.
<p class="text-muted">
Secondary body text with a <a href="#" class="text-reset">reset link</a>.
</p>
Text decoration
Decorate text in components with text decoration classes.
This text has a line underneath it.
This text has a line going through it.
This link has its text decoration removed<p class="text-decoration-underline">This text has a line underneath it.</p>
<p class="text-decoration-line-through">This text has a line going through it.</p>
<a href="#" class="text-decoration-none">This link has its text decoration removed</a>
CSS
Variables
--#{$prefix}font-size-display-large: #{px-to-rem($ouds-font-size-display-large-mobile)};
--#{$prefix}font-size-display-medium: #{px-to-rem($ouds-font-size-display-medium-mobile)};
--#{$prefix}font-size-display-small: #{px-to-rem($ouds-font-size-display-small-mobile)};
--#{$prefix}font-size-heading-xlarge: #{px-to-rem($ouds-font-size-heading-xlarge-mobile)};
--#{$prefix}font-size-heading-large: #{px-to-rem($ouds-font-size-heading-large-mobile)};
--#{$prefix}font-size-heading-medium: #{px-to-rem($ouds-font-size-heading-medium-mobile)};
--#{$prefix}font-size-heading-small: #{px-to-rem($ouds-font-size-heading-small-mobile)};
--#{$prefix}font-size-body-large: #{px-to-rem($ouds-font-size-body-large-mobile)};
--#{$prefix}font-size-body-medium: #{px-to-rem($ouds-font-size-body-medium-mobile)};
--#{$prefix}font-size-body-small: #{px-to-rem($ouds-font-size-body-small-mobile)};
--#{$prefix}font-size-label-xlarge: #{px-to-rem($ouds-font-size-label-xlarge)};
--#{$prefix}font-size-label-large: #{px-to-rem($ouds-font-size-label-large)};
--#{$prefix}font-size-label-medium: #{px-to-rem($ouds-font-size-label-medium)};
--#{$prefix}font-size-label-small: #{px-to-rem($ouds-font-size-label-small)};
--#{$prefix}font-size-code-medium: #{px-to-rem($ouds-font-size-code-medium)};
--#{$prefix}font-line-height-display-large: #{divide($ouds-font-line-height-display-large-mobile, $ouds-font-size-display-large-mobile)};
--#{$prefix}font-line-height-display-medium: #{divide($ouds-font-line-height-display-medium-mobile, $ouds-font-size-display-medium-mobile)};
--#{$prefix}font-line-height-display-small: #{divide($ouds-font-line-height-display-small-mobile, $ouds-font-size-display-small-mobile)};
--#{$prefix}font-line-height-heading-xlarge: #{divide($ouds-font-line-height-heading-xlarge-mobile, $ouds-font-size-heading-xlarge-mobile)};
--#{$prefix}font-line-height-heading-large: #{divide($ouds-font-line-height-heading-large-mobile, $ouds-font-size-heading-large-mobile)};
--#{$prefix}font-line-height-heading-medium: #{divide($ouds-font-line-height-heading-medium-mobile, $ouds-font-size-heading-medium-mobile)};
--#{$prefix}font-line-height-heading-small: #{divide($ouds-font-line-height-heading-small-mobile, $ouds-font-size-heading-small-mobile)};
--#{$prefix}font-line-height-body-large: #{divide($ouds-font-line-height-body-large-mobile, $ouds-font-size-body-large-mobile)};
--#{$prefix}font-line-height-body-medium: #{divide($ouds-font-line-height-body-medium-mobile, $ouds-font-size-body-medium-mobile)};
--#{$prefix}font-line-height-body-small: #{divide($ouds-font-line-height-body-small-mobile, $ouds-font-size-body-small-mobile)};
--#{$prefix}font-line-height-label-xlarge: #{divide($ouds-font-line-height-label-xlarge, $ouds-font-size-label-xlarge)};
--#{$prefix}font-line-height-label-large: #{divide($ouds-font-line-height-label-large, $ouds-font-size-label-large)};
--#{$prefix}font-line-height-label-medium: #{divide($ouds-font-line-height-label-medium, $ouds-font-size-label-medium)};
--#{$prefix}font-line-height-label-small: #{divide($ouds-font-line-height-label-small, $ouds-font-size-label-small)};
--#{$prefix}font-line-height-code-medium: #{divide($ouds-font-line-height-label-small, $ouds-font-size-code-medium)};
--#{$prefix}font-letter-spacing-display-large: #{px-to-rem($ouds-font-letter-spacing-display-large-mobile)};
--#{$prefix}font-letter-spacing-display-medium: #{px-to-rem($ouds-font-letter-spacing-display-medium-mobile)};
--#{$prefix}font-letter-spacing-display-small: #{px-to-rem($ouds-font-letter-spacing-display-small-mobile)};
--#{$prefix}font-letter-spacing-heading-xlarge: #{px-to-rem($ouds-font-letter-spacing-heading-xlarge-mobile)};
--#{$prefix}font-letter-spacing-heading-large: #{px-to-rem($ouds-font-letter-spacing-heading-large-mobile)};
--#{$prefix}font-letter-spacing-heading-medium: #{px-to-rem($ouds-font-letter-spacing-heading-medium-mobile)};
--#{$prefix}font-letter-spacing-heading-small: #{px-to-rem($ouds-font-letter-spacing-heading-small-mobile)};
--#{$prefix}font-letter-spacing-body-large: #{px-to-rem($ouds-font-letter-spacing-body-large-mobile)};
--#{$prefix}font-letter-spacing-body-medium: #{px-to-rem($ouds-font-letter-spacing-body-medium-mobile)};
--#{$prefix}font-letter-spacing-body-small: #{px-to-rem($ouds-font-letter-spacing-body-small-mobile)};
--#{$prefix}font-letter-spacing-label-xlarge: #{px-to-rem($ouds-font-letter-spacing-label-xlarge)};
--#{$prefix}font-letter-spacing-label-large: #{px-to-rem($ouds-font-letter-spacing-label-large)};
--#{$prefix}font-letter-spacing-label-medium: #{px-to-rem($ouds-font-letter-spacing-label-medium)};
--#{$prefix}font-letter-spacing-label-small: #{px-to-rem($ouds-font-letter-spacing-label-small)};
--#{$prefix}font-letter-spacing-code-medium: #{px-to-rem($ouds-font-letter-spacing-code-medium)};
--#{$prefix}font-max-width-display-large: #{px-to-rem($ouds-size-max-width-type-display-large-mobile)};
--#{$prefix}font-max-width-display-medium: #{px-to-rem($ouds-size-max-width-type-display-medium-mobile)};
--#{$prefix}font-max-width-display-small: #{px-to-rem($ouds-size-max-width-type-display-small-mobile)};
--#{$prefix}font-max-width-heading-xlarge: #{px-to-rem($ouds-size-max-width-type-heading-xlarge-mobile)};
--#{$prefix}font-max-width-heading-large: #{px-to-rem($ouds-size-max-width-type-heading-large-mobile)};
--#{$prefix}font-max-width-heading-medium: #{px-to-rem($ouds-size-max-width-type-heading-medium-mobile)};
--#{$prefix}font-max-width-heading-small: #{px-to-rem($ouds-size-max-width-type-heading-small-mobile)};
--#{$prefix}font-max-width-body-large: #{px-to-rem($ouds-size-max-width-type-body-large-mobile)};
--#{$prefix}font-max-width-body-medium: #{px-to-rem($ouds-size-max-width-type-body-medium-mobile)};
--#{$prefix}font-max-width-body-small: #{px-to-rem($ouds-size-max-width-type-body-small-mobile)};
@include media-breakpoint-up(md) {
--#{$prefix}font-size-display-large: #{px-to-rem($ouds-font-size-display-large-tablet)};
--#{$prefix}font-size-display-medium: #{px-to-rem($ouds-font-size-display-medium-tablet)};
--#{$prefix}font-size-display-small: #{px-to-rem($ouds-font-size-display-small-tablet)};
--#{$prefix}font-size-heading-xlarge: #{px-to-rem($ouds-font-size-heading-xlarge-tablet)};
--#{$prefix}font-size-heading-large: #{px-to-rem($ouds-font-size-heading-large-tablet)};
--#{$prefix}font-size-heading-medium: #{px-to-rem($ouds-font-size-heading-medium-tablet)};
--#{$prefix}font-size-heading-small: #{px-to-rem($ouds-font-size-heading-small-tablet)};
--#{$prefix}font-size-body-large: #{px-to-rem($ouds-font-size-body-large-tablet)};
--#{$prefix}font-size-body-medium: #{px-to-rem($ouds-font-size-body-medium-tablet)};
--#{$prefix}font-size-body-small: #{px-to-rem($ouds-font-size-body-small-tablet)};
--#{$prefix}font-line-height-display-large: #{divide($ouds-font-line-height-display-large-tablet, $ouds-font-size-display-large-tablet)};
--#{$prefix}font-line-height-display-medium: #{divide($ouds-font-line-height-display-medium-tablet, $ouds-font-size-display-medium-tablet)};
--#{$prefix}font-line-height-display-small: #{divide($ouds-font-line-height-display-small-tablet, $ouds-font-size-display-small-tablet)};
--#{$prefix}font-line-height-heading-xlarge: #{divide($ouds-font-line-height-heading-xlarge-tablet, $ouds-font-size-heading-xlarge-tablet)};
--#{$prefix}font-line-height-heading-large: #{divide($ouds-font-line-height-heading-large-tablet, $ouds-font-size-heading-large-tablet)};
--#{$prefix}font-line-height-heading-medium: #{divide($ouds-font-line-height-heading-medium-tablet, $ouds-font-size-heading-medium-tablet)};
--#{$prefix}font-line-height-heading-small: #{divide($ouds-font-line-height-heading-small-tablet, $ouds-font-size-heading-small-tablet)};
--#{$prefix}font-line-height-body-large: #{divide($ouds-font-line-height-body-large-tablet, $ouds-font-size-body-large-tablet)};
--#{$prefix}font-line-height-body-medium: #{divide($ouds-font-line-height-body-medium-tablet, $ouds-font-size-body-medium-tablet)};
--#{$prefix}font-line-height-body-small: #{divide($ouds-font-line-height-body-small-tablet, $ouds-font-size-body-small-tablet)};
--#{$prefix}font-letter-spacing-display-large: #{px-to-rem($ouds-font-letter-spacing-display-large-tablet)};
--#{$prefix}font-letter-spacing-display-medium: #{px-to-rem($ouds-font-letter-spacing-display-medium-tablet)};
--#{$prefix}font-letter-spacing-display-small: #{px-to-rem($ouds-font-letter-spacing-display-small-tablet)};
--#{$prefix}font-letter-spacing-heading-xlarge: #{px-to-rem($ouds-font-letter-spacing-heading-xlarge-tablet)};
--#{$prefix}font-letter-spacing-heading-large: #{px-to-rem($ouds-font-letter-spacing-heading-large-tablet)};
--#{$prefix}font-letter-spacing-heading-medium: #{px-to-rem($ouds-font-letter-spacing-heading-medium-tablet)};
--#{$prefix}font-letter-spacing-heading-small: #{px-to-rem($ouds-font-letter-spacing-heading-small-tablet)};
--#{$prefix}font-letter-spacing-body-large: #{px-to-rem($ouds-font-letter-spacing-body-large-tablet)};
--#{$prefix}font-letter-spacing-body-medium: #{px-to-rem($ouds-font-letter-spacing-body-medium-tablet)};
--#{$prefix}font-letter-spacing-body-small: #{px-to-rem($ouds-font-letter-spacing-body-small-tablet)};
--#{$prefix}font-max-width-display-large: #{px-to-rem($ouds-size-max-width-type-display-large-tablet)};
--#{$prefix}font-max-width-display-medium: #{px-to-rem($ouds-size-max-width-type-display-medium-tablet)};
--#{$prefix}font-max-width-display-small: #{px-to-rem($ouds-size-max-width-type-display-small-tablet)};
--#{$prefix}font-max-width-heading-xlarge: #{px-to-rem($ouds-size-max-width-type-heading-xlarge-tablet)};
--#{$prefix}font-max-width-heading-large: #{px-to-rem($ouds-size-max-width-type-heading-large-tablet)};
--#{$prefix}font-max-width-heading-medium: #{px-to-rem($ouds-size-max-width-type-heading-medium-tablet)};
--#{$prefix}font-max-width-heading-small: #{px-to-rem($ouds-size-max-width-type-heading-small-tablet)};
--#{$prefix}font-max-width-body-large: #{px-to-rem($ouds-size-max-width-type-body-large-tablet)};
--#{$prefix}font-max-width-body-medium: #{px-to-rem($ouds-size-max-width-type-body-medium-tablet)};
--#{$prefix}font-max-width-body-small: #{px-to-rem($ouds-size-max-width-type-body-small-tablet)};
}
@include media-breakpoint-up(xl) {
--#{$prefix}font-size-display-large: #{px-to-rem($ouds-font-size-display-large-desktop)};
--#{$prefix}font-size-display-medium: #{px-to-rem($ouds-font-size-display-medium-desktop)};
--#{$prefix}font-size-display-small: #{px-to-rem($ouds-font-size-display-small-desktop)};
--#{$prefix}font-size-heading-xlarge: #{px-to-rem($ouds-font-size-heading-xlarge-desktop)};
--#{$prefix}font-size-heading-large: #{px-to-rem($ouds-font-size-heading-large-desktop)};
--#{$prefix}font-size-heading-medium: #{px-to-rem($ouds-font-size-heading-medium-desktop)};
--#{$prefix}font-size-heading-small: #{px-to-rem($ouds-font-size-heading-small-desktop)};
--#{$prefix}font-size-body-large: #{px-to-rem($ouds-font-size-body-large-desktop)};
--#{$prefix}font-size-body-medium: #{px-to-rem($ouds-font-size-body-medium-desktop)};
--#{$prefix}font-size-body-small: #{px-to-rem($ouds-font-size-body-small-desktop)};
--#{$prefix}font-line-height-display-large: #{divide($ouds-font-line-height-display-large-desktop, $ouds-font-size-display-large-desktop)};
--#{$prefix}font-line-height-display-medium: #{divide($ouds-font-line-height-display-medium-desktop, $ouds-font-size-display-medium-desktop)};
--#{$prefix}font-line-height-display-small: #{divide($ouds-font-line-height-display-small-desktop, $ouds-font-size-display-small-desktop)};
--#{$prefix}font-line-height-heading-xlarge: #{divide($ouds-font-line-height-heading-xlarge-desktop, $ouds-font-size-heading-xlarge-desktop)};
--#{$prefix}font-line-height-heading-large: #{divide($ouds-font-line-height-heading-large-desktop, $ouds-font-size-heading-large-desktop)};
--#{$prefix}font-line-height-heading-medium: #{divide($ouds-font-line-height-heading-medium-desktop, $ouds-font-size-heading-medium-desktop)};
--#{$prefix}font-line-height-heading-small: #{divide($ouds-font-line-height-heading-small-desktop, $ouds-font-size-heading-small-desktop)};
--#{$prefix}font-line-height-body-large: #{divide($ouds-font-line-height-body-large-desktop, $ouds-font-size-body-large-desktop)};
--#{$prefix}font-line-height-body-medium: #{divide($ouds-font-line-height-body-medium-desktop, $ouds-font-size-body-medium-desktop)};
--#{$prefix}font-line-height-body-small: #{divide($ouds-font-line-height-body-small-desktop, $ouds-font-size-body-small-desktop)};
--#{$prefix}font-letter-spacing-display-large: #{px-to-rem($ouds-font-letter-spacing-display-large-desktop)};
--#{$prefix}font-letter-spacing-display-medium: #{px-to-rem($ouds-font-letter-spacing-display-medium-desktop)};
--#{$prefix}font-letter-spacing-display-small: #{px-to-rem($ouds-font-letter-spacing-display-small-desktop)};
--#{$prefix}font-letter-spacing-heading-xlarge: #{px-to-rem($ouds-font-letter-spacing-heading-xlarge-desktop)};
--#{$prefix}font-letter-spacing-heading-large: #{px-to-rem($ouds-font-letter-spacing-heading-large-desktop)};
--#{$prefix}font-letter-spacing-heading-medium: #{px-to-rem($ouds-font-letter-spacing-heading-medium-desktop)};
--#{$prefix}font-letter-spacing-heading-small: #{px-to-rem($ouds-font-letter-spacing-heading-small-desktop)};
--#{$prefix}font-letter-spacing-body-large: #{px-to-rem($ouds-font-letter-spacing-body-large-desktop)};
--#{$prefix}font-letter-spacing-body-medium: #{px-to-rem($ouds-font-letter-spacing-body-medium-desktop)};
--#{$prefix}font-letter-spacing-body-small: #{px-to-rem($ouds-font-letter-spacing-body-small-desktop)};
--#{$prefix}font-max-width-display-large: #{px-to-rem($ouds-size-max-width-type-display-large-desktop)};
--#{$prefix}font-max-width-display-medium: #{px-to-rem($ouds-size-max-width-type-display-medium-desktop)};
--#{$prefix}font-max-width-display-small: #{px-to-rem($ouds-size-max-width-type-display-small-desktop)};
--#{$prefix}font-max-width-heading-xlarge: #{px-to-rem($ouds-size-max-width-type-heading-xlarge-desktop)};
--#{$prefix}font-max-width-heading-large: #{px-to-rem($ouds-size-max-width-type-heading-large-desktop)};
--#{$prefix}font-max-width-heading-medium: #{px-to-rem($ouds-size-max-width-type-heading-medium-desktop)};
--#{$prefix}font-max-width-heading-small: #{px-to-rem($ouds-size-max-width-type-heading-small-desktop)};
--#{$prefix}font-max-width-body-large: #{px-to-rem($ouds-size-max-width-type-body-large-desktop)};
--#{$prefix}font-max-width-body-medium: #{px-to-rem($ouds-size-max-width-type-body-medium-desktop)};
--#{$prefix}font-max-width-body-small: #{px-to-rem($ouds-size-max-width-type-body-small-desktop)};
}
Sass tokens
Raw tokens
Font raw tokens as Sass variables. Not to be used as-is.
$ouds-font-family-brand-default: "Helvetica Neue";
// $ouds-font-family-brand-tv: "Helvetica Neue LT";
// $ouds-font-family-monospace-courier-new: "Courier New";
// $ouds-font-family-monospace-menlo: "Menlo";
// $ouds-font-family-monospace-monaco: "Monaco";
// $ouds-font-family-monospace-sf-mono: "SF Mono";
// $ouds-font-family-system-arial: "Arial";
// $ouds-font-family-system-helvetica: "Helvetica";
// $ouds-font-family-system-noto-sans: "Noto Sans";
// $ouds-font-family-system-roboto: "Roboto";
// $ouds-font-family-system-sf-pro: "SF Pro";
$ouds-font-letter-spacing-150: .18px;
// $ouds-font-letter-spacing-175: .19px;
$ouds-font-letter-spacing-200: .17px;
$ouds-font-letter-spacing-250: .2px;
$ouds-font-letter-spacing-300: .18px;
$ouds-font-letter-spacing-350: 0;
$ouds-font-letter-spacing-450: -.12px;
$ouds-font-letter-spacing-550: -.28px;
$ouds-font-letter-spacing-650: -.32px;
$ouds-font-letter-spacing-750: -.36px;
$ouds-font-letter-spacing-850: -.4px;
// $ouds-font-letter-spacing-950: -.55px;
$ouds-font-letter-spacing-1050: -.6px;
// $ouds-font-letter-spacing-1150: -.65px;
$ouds-font-letter-spacing-1250: -.7px;
$ouds-font-letter-spacing-1450: -.96px;
$ouds-font-letter-spacing-1850: -1.08px;
$ouds-font-line-height-250: 16px;
$ouds-font-line-height-350: 20px;
$ouds-font-line-height-450: 24px;
$ouds-font-line-height-550: 28px;
$ouds-font-line-height-650: 32px;
$ouds-font-line-height-750: 36px;
$ouds-font-line-height-850: 40px;
$ouds-font-line-height-950: 44px;
$ouds-font-line-height-1050: 48px;
// $ouds-font-line-height-1150: 52px;
$ouds-font-line-height-1250: 56px;
// $ouds-font-line-height-1350: 60px;
$ouds-font-line-height-1450: 64px;
$ouds-font-line-height-1850: 72px;
$ouds-font-line-height-2050: 80px;
$ouds-font-size-150: 12px;
// $ouds-font-size-175: 13px;
$ouds-font-size-200: 14px;
$ouds-font-size-250: 16px;
$ouds-font-size-300: 18px;
$ouds-font-size-350: 20px;
$ouds-font-size-450: 24px;
$ouds-font-size-550: 28px;
$ouds-font-size-650: 32px;
$ouds-font-size-750: 36px;
$ouds-font-size-850: 40px;
// $ouds-font-size-950: 44px;
$ouds-font-size-1050: 48px;
// $ouds-font-size-1150: 52px;
$ouds-font-size-1250: 56px;
$ouds-font-size-1450: 64px;
$ouds-font-size-1850: 72px;
// $ouds-font-weight-100: 100;
// $ouds-font-weight-200: 200;
// $ouds-font-weight-300: 300;
$ouds-font-weight-400: 400;
// $ouds-font-weight-500: 500;
// $ouds-font-weight-600: 600;
$ouds-font-weight-700: 700;
// $ouds-font-weight-800: 800;
// $ouds-font-weight-900: 900;
// $ouds-font-weight-950: 950;
Semantic tokens
Font semantic tokens are defined as Sass variables.
$ouds-font-family: $ouds-font-family-brand-default;
$ouds-font-letter-spacing-body-large-desktop: $ouds-font-letter-spacing-300;
$ouds-font-letter-spacing-body-large-mobile: $ouds-font-letter-spacing-250;
$ouds-font-letter-spacing-body-large-tablet: $ouds-font-letter-spacing-250;
$ouds-font-letter-spacing-body-medium-desktop: $ouds-font-letter-spacing-250;
$ouds-font-letter-spacing-body-medium-mobile: $ouds-font-letter-spacing-200;
$ouds-font-letter-spacing-body-medium-tablet: $ouds-font-letter-spacing-200;
$ouds-font-letter-spacing-body-small-desktop: $ouds-font-letter-spacing-200;
$ouds-font-letter-spacing-body-small-mobile: $ouds-font-letter-spacing-150;
$ouds-font-letter-spacing-body-small-tablet: $ouds-font-letter-spacing-150;
$ouds-font-letter-spacing-code-medium: $ouds-font-letter-spacing-200;
$ouds-font-letter-spacing-display-large-desktop: $ouds-font-letter-spacing-1850;
$ouds-font-letter-spacing-display-large-mobile: $ouds-font-letter-spacing-850;
$ouds-font-letter-spacing-display-large-tablet: $ouds-font-letter-spacing-1450;
$ouds-font-letter-spacing-display-medium-desktop: $ouds-font-letter-spacing-1250;
$ouds-font-letter-spacing-display-medium-mobile: $ouds-font-letter-spacing-750;
$ouds-font-letter-spacing-display-medium-tablet: $ouds-font-letter-spacing-1050;
$ouds-font-letter-spacing-display-small-desktop: $ouds-font-letter-spacing-1050;
$ouds-font-letter-spacing-display-small-mobile: $ouds-font-letter-spacing-650;
$ouds-font-letter-spacing-display-small-tablet: $ouds-font-letter-spacing-850;
$ouds-font-letter-spacing-heading-large-desktop: $ouds-font-letter-spacing-650;
$ouds-font-letter-spacing-heading-large-mobile: $ouds-font-letter-spacing-450;
$ouds-font-letter-spacing-heading-large-tablet: $ouds-font-letter-spacing-550;
$ouds-font-letter-spacing-heading-medium-desktop: $ouds-font-letter-spacing-550;
$ouds-font-letter-spacing-heading-medium-mobile: $ouds-font-letter-spacing-350;
$ouds-font-letter-spacing-heading-medium-tablet: $ouds-font-letter-spacing-450;
$ouds-font-letter-spacing-heading-small-desktop: $ouds-font-letter-spacing-450;
$ouds-font-letter-spacing-heading-small-mobile: $ouds-font-letter-spacing-300;
$ouds-font-letter-spacing-heading-small-tablet: $ouds-font-letter-spacing-350;
$ouds-font-letter-spacing-heading-xlarge-desktop: $ouds-font-letter-spacing-850;
$ouds-font-letter-spacing-heading-xlarge-mobile: $ouds-font-letter-spacing-550;
$ouds-font-letter-spacing-heading-xlarge-tablet: $ouds-font-letter-spacing-750;
$ouds-font-letter-spacing-label-large: $ouds-font-letter-spacing-250;
$ouds-font-letter-spacing-label-medium: $ouds-font-letter-spacing-200;
$ouds-font-letter-spacing-label-small: $ouds-font-letter-spacing-150;
$ouds-font-letter-spacing-label-xlarge: $ouds-font-letter-spacing-300;
$ouds-font-line-height-body-large-desktop: $ouds-font-line-height-450;
$ouds-font-line-height-body-large-mobile: $ouds-font-line-height-450;
$ouds-font-line-height-body-large-tablet: $ouds-font-line-height-450;
$ouds-font-line-height-body-medium-desktop: $ouds-font-line-height-450;
$ouds-font-line-height-body-medium-mobile: $ouds-font-line-height-350;
$ouds-font-line-height-body-medium-tablet: $ouds-font-line-height-350;
$ouds-font-line-height-body-small-desktop: $ouds-font-line-height-350;
$ouds-font-line-height-body-small-mobile: $ouds-font-line-height-250;
$ouds-font-line-height-body-small-tablet: $ouds-font-line-height-250;
$ouds-font-line-height-code-medium: $ouds-font-line-height-350;
$ouds-font-line-height-display-large-desktop: $ouds-font-line-height-2050;
$ouds-font-line-height-display-large-mobile: $ouds-font-line-height-1050;
$ouds-font-line-height-display-large-tablet: $ouds-font-line-height-1850;
$ouds-font-line-height-display-medium-desktop: $ouds-font-line-height-1450;
$ouds-font-line-height-display-medium-mobile: $ouds-font-line-height-950;
$ouds-font-line-height-display-medium-tablet: $ouds-font-line-height-1250;
$ouds-font-line-height-display-small-desktop: $ouds-font-line-height-1250;
$ouds-font-line-height-display-small-mobile: $ouds-font-line-height-850;
$ouds-font-line-height-display-small-tablet: $ouds-font-line-height-1050;
$ouds-font-line-height-heading-large-desktop: $ouds-font-line-height-850;
$ouds-font-line-height-heading-large-mobile: $ouds-font-line-height-650;
$ouds-font-line-height-heading-large-tablet: $ouds-font-line-height-750;
$ouds-font-line-height-heading-medium-desktop: $ouds-font-line-height-750;
$ouds-font-line-height-heading-medium-mobile: $ouds-font-line-height-550;
$ouds-font-line-height-heading-medium-tablet: $ouds-font-line-height-650;
$ouds-font-line-height-heading-small-desktop: $ouds-font-line-height-650;
$ouds-font-line-height-heading-small-mobile: $ouds-font-line-height-450;
$ouds-font-line-height-heading-small-tablet: $ouds-font-line-height-550;
$ouds-font-line-height-heading-xlarge-desktop: $ouds-font-line-height-1050;
$ouds-font-line-height-heading-xlarge-mobile: $ouds-font-line-height-750;
$ouds-font-line-height-heading-xlarge-tablet: $ouds-font-line-height-950;
$ouds-font-line-height-label-large: $ouds-font-line-height-450;
$ouds-font-line-height-label-medium: $ouds-font-line-height-350;
$ouds-font-line-height-label-small: $ouds-font-line-height-250;
$ouds-font-line-height-label-xlarge: $ouds-font-line-height-450;
$ouds-font-size-body-large-desktop: $ouds-font-size-300;
$ouds-font-size-body-large-mobile: $ouds-font-size-250;
$ouds-font-size-body-large-tablet: $ouds-font-size-250;
$ouds-font-size-body-medium-desktop: $ouds-font-size-250;
$ouds-font-size-body-medium-mobile: $ouds-font-size-200;
$ouds-font-size-body-medium-tablet: $ouds-font-size-200;
$ouds-font-size-body-small-desktop: $ouds-font-size-200;
$ouds-font-size-body-small-mobile: $ouds-font-size-150;
$ouds-font-size-body-small-tablet: $ouds-font-size-150;
$ouds-font-size-code-medium: $ouds-font-size-200;
$ouds-font-size-display-large-desktop: $ouds-font-size-1850;
$ouds-font-size-display-large-mobile: $ouds-font-size-850;
$ouds-font-size-display-large-tablet: $ouds-font-size-1450;
$ouds-font-size-display-medium-desktop: $ouds-font-size-1250;
$ouds-font-size-display-medium-mobile: $ouds-font-size-750;
$ouds-font-size-display-medium-tablet: $ouds-font-size-1050;
$ouds-font-size-display-small-desktop: $ouds-font-size-1050;
$ouds-font-size-display-small-mobile: $ouds-font-size-650;
$ouds-font-size-display-small-tablet: $ouds-font-size-850;
$ouds-font-size-heading-large-desktop: $ouds-font-size-650;
$ouds-font-size-heading-large-mobile: $ouds-font-size-450;
$ouds-font-size-heading-large-tablet: $ouds-font-size-550;
$ouds-font-size-heading-medium-desktop: $ouds-font-size-550;
$ouds-font-size-heading-medium-mobile: $ouds-font-size-350;
$ouds-font-size-heading-medium-tablet: $ouds-font-size-450;
$ouds-font-size-heading-small-desktop: $ouds-font-size-450;
$ouds-font-size-heading-small-mobile: $ouds-font-size-300;
$ouds-font-size-heading-small-tablet: $ouds-font-size-350;
$ouds-font-size-heading-xlarge-desktop: $ouds-font-size-850;
$ouds-font-size-heading-xlarge-mobile: $ouds-font-size-550;
$ouds-font-size-heading-xlarge-tablet: $ouds-font-size-750;
$ouds-font-size-label-large: $ouds-font-size-250;
$ouds-font-size-label-medium: $ouds-font-size-200;
$ouds-font-size-label-small: $ouds-font-size-150;
$ouds-font-size-label-xlarge: $ouds-font-size-300;
$ouds-font-weight-code: $ouds-font-weight-400;
$ouds-font-weight-default: $ouds-font-weight-400;
$ouds-font-weight-strong: $ouds-font-weight-700;
$ouds-font-weight-body-default: $ouds-font-weight-default;
$ouds-font-weight-body-strong: $ouds-font-weight-strong;
$ouds-font-weight-display: $ouds-font-weight-strong;
$ouds-font-weight-heading: $ouds-font-weight-strong;
$ouds-font-weight-label-default: $ouds-font-weight-default;
$ouds-font-weight-label-strong: $ouds-font-weight-strong;
Composite tokens
Font composite tokens are defined as Sass variables.
$ouds-font-family-sans-serif-stack: "Helvetica Neue", Helvetica, "SF Pro", Roboto, Arial, "Noto Sans", "Liberation Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
$ouds-font-family-monospace-stack: Consolas, "SFMono-Regular", "Roboto Mono", "Liberation Mono", Menlo, monospace;
Sass variables
Default type and font related Sass variables:
$font-family-sans-serif: $ouds-font-family-sans-serif-stack; // OUDS mod
$font-family-monospace: $ouds-font-family-monospace-stack; // OUDS mod
$font-family-base: var(--#{$prefix}font-sans-serif);
$font-family-code: var(--#{$prefix}font-monospace);
// OUDS mod
//// Type scale & vertical rhythm completely revamped to match Orange Web Guidelines
// $font-size-root affects the value of `rem`, which is used for as well font sizes, paddings and margins
// $font-size-base affects the font size of the body text
$font-size-root: null;
$font-size-base: var(--#{$prefix}font-size-body-medium); // Assumes the browser default, typically `16px`
$font-size-sm: var(--#{$prefix}font-size-body-small); // 14px
$font-size-lg: var(--#{$prefix}font-size-body-large); // 18px
$font-weight-lighter: null;
$font-weight-light: null;
$font-weight-normal: $ouds-font-weight-default;
$font-weight-medium: null;
$font-weight-semibold: null;
$font-weight-bold: $ouds-font-weight-strong;
$font-weight-bolder: null;
$font-weight-base: $font-weight-normal;
$line-height-base: var(--#{$prefix}font-line-height-body-medium);
$line-height-sm: var(--#{$prefix}font-line-height-body-small);
$line-height-lg: var(--#{$prefix}font-line-height-body-large);
$letter-spacing-base: var(--#{$prefix}font-letter-spacing-body-medium);
$h1-font-size: var(--#{$prefix}font-size-heading-xlarge);
$h2-font-size: var(--#{$prefix}font-size-heading-large);
$h3-font-size: var(--#{$prefix}font-size-heading-medium);
$h4-font-size: var(--#{$prefix}font-size-heading-small);
$h5-font-size: var(--#{$prefix}font-size-body-large);
$h6-font-size: var(--#{$prefix}font-size-body-medium);
Sass maps
Font-size utilities are generated from these maps, in combination with our utilities API.
$ouds-font-sizes: (
cm: "/code-medium",
bs: "/body-small",
bm: "/body-medium",
bl: "/body-large",
hs: "/heading-small",
hm: "/heading-medium",
hl: "/heading-large",
hxl: "/heading-xlarge",
ds: "/display-small",
dm: "/display-medium",
dl: "/display-large",
);
$ouds-font-weights: (
normal: $ouds-font-weight-default,
bold: $ouds-font-weight-strong
);
$ouds-icon-sizes: ("sm", "md", "lg");
Bootstrap $enable-bootstrap-compatibility: true
This part is enabled only when $enable-bootstrap-compatibility
is set to true
. Read more about Bootstrap compatibility.
$font-sizes: (
1: $h1-font-size,
2: $h2-font-size,
3: $h3-font-size,
4: $h4-font-size,
5: $h5-font-size,
6: $h6-font-size
);
$theme-colors-text: (
"primary": $primary-text-emphasis,
"secondary": $secondary-text-emphasis,
"success": $success-text-emphasis,
"info": $info-text-emphasis,
"warning": $warning-text-emphasis,
"danger": $danger-text-emphasis,
"light": $light-text-emphasis,
"dark": $dark-text-emphasis,
);
Sass mixins
We provide a dedicated mixin for font reference called get-font-size($font-size-reference)
.
// $font-size-ref can be one of: "code-medium", "label-small", "label-medium", "label-large", "label-xlarge", "body-small", "body-medium", "body-large", "heading-small", "heading-medium", "heading-large", "heading-xlarge", "display-small", "display-medium", "display-large"
@mixin get-font-size($font-size-ref: "display-large") {
@if str-slice($font-size-ref, 1, 5) != "label" and str-slice($font-size-ref, 1, 4) != "code" {
max-width: var(--#{$prefix}font-max-width-#{$font-size-ref});
}
font-size: var(--#{$prefix}font-size-#{$font-size-ref});
line-height: var(--#{$prefix}font-line-height-#{$font-size-ref});
/* rtl:remove */
letter-spacing: var(--#{$prefix}font-letter-spacing-#{$font-size-ref});
}
Whenever you need a font reference inside a custom component or for whatever reason, please follow the same process as us, so you don’t miss any information about a font reference.
%heading {
margin-top: 0; // 1
margin-bottom: $headings-margin-bottom;
font-family: $headings-font-family;
font-style: $headings-font-style;
font-weight: $headings-font-weight;
line-height: $headings-line-height;
color: var(--#{$prefix}heading-color);
/* rtl:remove */
-webkit-font-smoothing: antialiased; // OUDS mod
-moz-osx-font-smoothing: grayscale; // OUDS mod
text-rendering: optimizelegibility; // OUDS mod
}
h1 {
@extend %heading;
@include get-font-size("heading-xlarge"); // OUDS mod: instead of `@include font-size($h1-font-size)`
}
h2 {
@extend %heading;
@include get-font-size("heading-large"); // OUDS mod: instead of `@include font-size($h2-font-size)`
}
h3 {
@extend %heading;
@include get-font-size("heading-medium"); // OUDS mod: instead of `@include font-size($h3-font-size)`
}
h4 {
@extend %heading;
@include get-font-size("heading-small"); // OUDS mod: instead of `@include font-size($h4-font-size)`
}
h5 {
@extend %heading;
@include get-font-size("body-large"); // OUDS mod: instead of `@include font-size($h5-font-size)`
}
h6 {
@extend %heading;
@include get-font-size("body-medium"); // OUDS mod: instead of `@include font-size($h6-font-size)`
}
Sass utilities API
Font and text utilities are declared in our utilities API in scss/_utilities.scss
. Learn how to use the utilities API.
"font-size-ouds": (
property: font-size,
class: fs,
values: $ouds-font-sizes
),
"font-weight-ouds": (
property: font-weight,
class: fw,
values: $ouds-font-weights
),
"font-family": (
property: font-family,
class: font,
values: (monospace: var(--#{$prefix}font-monospace))
),
"font-size": (
property: font-size,
class: fs,
values: $font-sizes,
bootstrap-compatibility: true
),
// OUDS mod: no font-style
"font-weight": (
property: font-weight,
class: fw,
values: (
lighter: $font-weight-lighter,
light: $font-weight-light,
// OUDS mod: no normal because handled by ouds map
medium: $font-weight-medium,
semibold: $font-weight-semibold,
// OUDS mod: no bold because handled by ouds map
bolder: $font-weight-bolder
),
bootstrap-compatibility: true
),
"line-height": (
property: line-height,
class: lh,
values: (
1: 1,
sm: $line-height-sm,
base: $line-height-base,
lg: $line-height-lg,
),
bootstrap-compatibility: true
),
"text-align": (
responsive: true,
property: text-align,
class: text,
values: (
start: left,
end: right,
center: center,
)
),
"text-decoration": (
property: text-decoration,
values: none underline line-through
),
"text-transform": (
property: text-transform,
class: text,
values: lowercase uppercase capitalize
),
"white-space": (
property: white-space,
class: text,
values: (
wrap: normal,
nowrap: nowrap,
)
),
"word-wrap": (
property: word-wrap word-break,
class: text,
values: (break: break-word),
rtl: false
),