From: Mark Otto Date: Fri, 23 May 2025 22:25:31 +0000 (-0700) Subject: Replace white-space utilities with text-wrap utilities, add new ones X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=refs%2Fheads%2Fv6%2Ftext-utils;p=thirdparty%2Fbootstrap.git Replace white-space utilities with text-wrap utilities, add new ones --- diff --git a/scss/_utilities.scss b/scss/_utilities.scss index 696f906ec9..1dd68c7362 100644 --- a/scss/_utilities.scss +++ b/scss/_utilities.scss @@ -557,20 +557,22 @@ $utilities: map-merge( 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 ), + "text-wrap": ( + property: text-wrap, + class: text, + values: ( + balance: balance, + nowrap: nowrap, + pretty: pretty, + wrap: wrap, + ) + ), // scss-docs-end utils-text // scss-docs-start utils-color "color": ( diff --git a/site/src/content/docs/utilities/text.mdx b/site/src/content/docs/utilities/text.mdx index 2cbf732770..557c3d1252 100644 --- a/site/src/content/docs/utilities/text.mdx +++ b/site/src/content/docs/utilities/text.mdx @@ -22,12 +22,12 @@ Easily realign text to components with text alignment classes. For start, end, a 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. -## Text wrapping and overflow +## Text wrap Wrap text with a `.text-wrap` class. - - This text should wrap. + + This snippet of text should wrap. `} /> Prevent text from wrapping with a `.text-nowrap` class. @@ -36,6 +36,18 @@ Prevent text from wrapping with a `.text-nowrap` class. This text should overflow the parent. `} /> +Use `.text-balance` to balance evenly distribute text across multiple lines. This is computationally expensive and is thus limited by the Chromium to six lines and by Firefox to ten lines. + + + This text should be balanced. Here we’re writing a longer snippet of text to form a paragraph and demonstrate how the text wraps. + `} /> + +Use `.text-pretty` to prevent single words their own line (orphans). **Pretty text wrapping is not fully supported in Safari and Firefox at the moment.** + + + This text should be pretty. Here we’re writing a longer snippet of text to form a paragraph and demonstrate how the text wraps. + `} /> + ## 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.