0
0
mirror of https://github.com/twbs/bootstrap.git synced 2024-12-02 14:24:19 +01:00
Bootstrap/site/content/docs/5.0/utilities/text.md
Patrick H. Lauke 764e5298de
Replace Lorem Ipsum placeholder text with more representative (or at least english language) text (#32246)
Replaces shorter examples with more sensible/representative/inforrmative text. For longer passages, resorted to using SFW extracts from http://katyperryipsum.com/
2020-12-11 20:05:33 +00:00

6.3 KiB
Raw Blame History

layout title description group toc
docs Text Documentation and examples for common text utilities to control alignment, wrapping, weight, and more. utilities true

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.

{{< example >}}

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.

{{< /example >}}

{{< callout info >}} Note that we don't provide utility classes for justified text. While, aesthetically, justified text might look more appealing, it does make word-spacing more random and therefore harder to read. {{< /callout >}}

Text wrapping and overflow

Wrap text with a .text-wrap class.

{{< example >}}

This text should wrap.
{{< /example >}}

Prevent text from wrapping with a .text-nowrap class.

{{< example >}}

This text should overflow the parent.
{{< /example >}}

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.

{{< example >}}

mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm

{{< /example >}}

{{< callout warning >}} Note that breaking words isn't possible in Arabic, which is the most used RTL language. Therefore .text-break is removed from our RTL compiled CSS. {{< /callout >}}

Text transform

Transform text in components with text capitalization classes.

{{< example >}}

Lowercased text.

Uppercased text.

CapiTaliZed text.

{{< /example >}}

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. 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.

{{< example >}}

.fs-1 text

.fs-2 text

.fs-3 text

.fs-4 text

.fs-5 text

.fs-6 text

{{< /example >}}

Customize your available font-sizes by modifying the $font-sizes Sass map.

{{< scss-docs name="font-sizes" file="scss/_variables.scss" >}}

Font weight and italics

Quickly change the font-weight or font-style of text with these utilities. font-style utilities are abbreviated as .fst-* and font-weight utilities are abbreviated as .fw-*.

{{< example >}}

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

{{< /example >}}

Line height

Change the line height with .lh-* utilities.

{{< example >}}

Some placeholder content to show off the line height utilities. Happy birthday. You could've been the greatest. She ride me like a roller coaster. I messed around and got addicted. You just gotta ignite the light and let it shine! I'm intrigued, for a peek, heard it's fascinating. Catch her if you can. I should've told you what you meant to me 'Cause now I pay the price. Do you ever feel, feel so paper thin.

But you better choose carefully. Yo, shout out to all you kids, buying bottle service, with your rent money. She's sweet as pie but if you break her heart. Just own the night like the 4th of July! In another life I would be your girl. Playing ping pong all night long, everything's all neon and hazy. Shorty so bad, Im sprung and I dont care.

I can feel a phoenix inside of me. Maybe a reason why all the doors are closed. We go higher and higher. Passport stamps, she's cosmopolitan. Someone said you had your tattoo removed. All my girls vintage Chanel baby. Someone said you had your tattoo removed.

But I will get there. This is real so take a chance and don't ever look back, don't ever look back. You could travel the world but nothing comes close to the golden coast. Of anything and everything. Venice beach and Palm Springs, summertime is everything. Do you ever feel already buried deep six feet under? It's time to bring out the big balloons. So cover your eyes, I have a surprise. So I don't have to say you were the one that got away.

{{< /example >}}

Monospace

Change a selection to our monospace font stack with .font-monospace.

{{< example >}}

This is in monospace

{{< /example >}}

Reset color

Reset a text or link's color with .text-reset, so that it inherits the color from its parent.

{{< example >}}

Muted text with a reset link.

{{< /example >}}

Text decoration

Decorate text in components with text decoration classes.

{{< example >}}

This text has a line underneath it.

This text has a line going through it.

This link has its text decoration removed {{< /example >}}