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.
Start aligned text on all viewport sizes.
Center aligned text on all viewport sizes.
End aligned text on all viewport sizes.
Start aligned text on viewports sized SM (small) or wider.
Start aligned text on viewports sized MD (medium) or wider.
Start aligned text on viewports sized LG (large) or wider.
Start aligned text on viewports sized XL (extra-large) or wider.
<template>
<b-p text-alignment="start">
Start aligned text on all viewport sizes.
</b-p>
<b-p text-alignment="center">
Center aligned text on all viewport sizes.
</b-p>
<b-p text-alignment="end">
End aligned text on all viewport sizes.
</b-p>
<b-p text-alignment="sm-start">
Start aligned text on viewports sized SM (small) or wider.
</b-p>
<b-p text-alignment="md-start">
Start aligned text on viewports sized MD (medium) or wider.
</b-p>
<b-p text-alignment="lg-start">
Start aligned text on viewports sized LG (large) or wider.
</b-p>
<b-p text-alignment="xl-start">
Start aligned text on viewports sized XL (extra-large) or wider.
</b-p>
</template>
Text wrapping and overflow
Wrap text with a text-wrap="wrap
.
Prevent text from wrapping with a text-wrap="nowrap"
.
<template>
<b-div
badge
background-color="primary"
text-wrap="wrap"
style="width: 6rem"
>
This text should wrap.
</b-div>
<b-div
background-color="highlight"
text-wrap="nowrap"
style="width: 8rem"
>
This text should overflow the parent.
</b-div>
</template>
Word break
Prevent long strings of text from breaking your components' layout by using text-break
attribute 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
<template>
<b-p text-break>
mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm
</b-p>
</template>
Text transform
Transform text in components with text text-transform
attribute.
Lowercased text.
Uppercased text.
CapiTaliZed text.
<template>
<b-p text-transform="lowercase">
Lowercased text.
</b-p>
<b-p text-transform="uppercase">
Uppercased text.
</b-p>
<b-p text-transform="capitalize">
CapiTaliZed text.
</b-p>
</template>
Note how text-transform="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. While our heading classes (e.g., level="1-6"
) 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
<template>
<b-p font-size="1">
.fs-1 text
</b-p>
<b-p font-size="2">
.fs-2 text
</b-p>
<b-p font-size="3">
.fs-3 text
</b-p>
<b-p font-size="4">
.fs-4 text
</b-p>
<b-p font-size="5">
.fs-5 text
</b-p>
<b-p font-size="6">
.fs-6 text
</b-p>
</template>
Font weight and italics
Quickly change the font-weight
or font-style
of text with these utilities.
Bold text.
Bolder weight text (relative to the parent element).
Normal weight text.
Light weight text.
Lighter weight text (relative to the parent element).
Italic text.
Text with normal font style
<template>
<b-p font-weight="bold">
Bold text.
</b-p>
<b-p font-weight="bolder">
Bolder weight text (relative to the parent element).
</b-p>
<b-p font-weight="normal">
Normal weight text.
</b-p>
<b-p font-weight="light">
Light weight text.
</b-p>
<b-p font-weight="lighter">
Lighter weight text (relative to the parent element).
</b-p>
<b-p font-style="italic">
Italic text.
</b-p>
<b-p font-style="normal">
Text with normal font style
</b-p>
</template>
Line height
Change the line-height
.
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.
<template>
<b-p line-height="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.
</b-p>
<b-p line-height="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.
</b-p>
<b-p line-height="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.
</b-p>
<b-p line-height="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.
</b-p>
</template>
Monospace
Change a selection to our monospace font stack with font-monospace
.
This is in monospace
<template>
<b-p font-monospace>
This is in monospace
</b-p>
</template>
Reset color
Reset a text or link's color with `text-reset`, so that it inherits the color from its parent.
Muted text with a reset link .
<template>
<b-p text-color="body-secondary">
Muted text with a
<Anchor
to="/"
text-reset
>
reset link
</Anchor>
.
</b-p>
</template>
Text decoration
Decorate text in components with text text-decoration
attributes.
This text has a line underneath it.
This text has a line going through it.
This link has its text decoration removed<template>
<b-p text-decoration="underline">
This text has a line underneath it.
</b-p>
<b-p text-decoration="line-through">
This text has a line going through it.
</b-p>
<Anchor
to="/"
text-decoration="none"
>
This link has its text decoration removed
</Anchor>
</template>