<aclass="btn btn-sm btn-bd-light mb-2 mb-md-0"href="https://github.com/twbs/bootstrap/blob/main/site/content/docs/5.0/utilities/text.md"title="View and edit this file on GitHub"target="_blank"rel="noopener">View on GitHub</a>
<h1class="bd-title"id="content">Text</h1>
</div>
<pclass="bd-lead">Documentation and examples for common text utilities to control alignment, wrapping, weight, and more.</p>
<p>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.</p>
<divclass="bd-example">
<pclass="text-start">Start aligned text on all viewport sizes.</p>
<pclass="text-center">Center aligned text on all viewport sizes.</p>
<pclass="text-end">End aligned text on all viewport sizes.</p>
<pclass="text-sm-start">Start aligned text on viewports sized SM (small) or wider.</p>
<pclass="text-md-start">Start aligned text on viewports sized MD (medium) or wider.</p>
<pclass="text-lg-start">Start aligned text on viewports sized LG (large) or wider.</p>
<pclass="text-xl-start">Start aligned text on viewports sized XL (extra-large) or wider.</p>
</div><divclass="highlight"><preclass="chroma"><codeclass="language-html"data-lang="html"><spanclass="p"><</span><spanclass="nt">p</span><spanclass="na">class</span><spanclass="o">=</span><spanclass="s">"text-start"</span><spanclass="p">></span>Start aligned text on all viewport sizes.<spanclass="p"></</span><spanclass="nt">p</span><spanclass="p">></span>
<spanclass="p"><</span><spanclass="nt">p</span><spanclass="na">class</span><spanclass="o">=</span><spanclass="s">"text-center"</span><spanclass="p">></span>Center aligned text on all viewport sizes.<spanclass="p"></</span><spanclass="nt">p</span><spanclass="p">></span>
<spanclass="p"><</span><spanclass="nt">p</span><spanclass="na">class</span><spanclass="o">=</span><spanclass="s">"text-end"</span><spanclass="p">></span>End aligned text on all viewport sizes.<spanclass="p"></</span><spanclass="nt">p</span><spanclass="p">></span>
<spanclass="p"><</span><spanclass="nt">p</span><spanclass="na">class</span><spanclass="o">=</span><spanclass="s">"text-sm-start"</span><spanclass="p">></span>Start aligned text on viewports sized SM (small) or wider.<spanclass="p"></</span><spanclass="nt">p</span><spanclass="p">></span>
<spanclass="p"><</span><spanclass="nt">p</span><spanclass="na">class</span><spanclass="o">=</span><spanclass="s">"text-md-start"</span><spanclass="p">></span>Start aligned text on viewports sized MD (medium) or wider.<spanclass="p"></</span><spanclass="nt">p</span><spanclass="p">></span>
<spanclass="p"><</span><spanclass="nt">p</span><spanclass="na">class</span><spanclass="o">=</span><spanclass="s">"text-lg-start"</span><spanclass="p">></span>Start aligned text on viewports sized LG (large) or wider.<spanclass="p"></</span><spanclass="nt">p</span><spanclass="p">></span>
<spanclass="p"><</span><spanclass="nt">p</span><spanclass="na">class</span><spanclass="o">=</span><spanclass="s">"text-xl-start"</span><spanclass="p">></span>Start aligned text on viewports sized XL (extra-large) or wider.<spanclass="p"></</span><spanclass="nt">p</span><spanclass="p">></span></code></pre></div>
<divclass="bd-callout bd-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.
</div>
<h2id="text-wrapping-and-overflow">Text wrapping and overflow</h2>
<p>Wrap text with a <code>.text-wrap</code> class.</p>
<p>Prevent long strings of text from breaking your components' layout by using <code>.text-break</code> to set <code>word-wrap: break-word</code> and <code>word-break: break-word</code>. We use <code>word-wrap</code> instead of the more common <code>overflow-wrap</code> for wider browser support, and add the deprecated <code>word-break: break-word</code> to avoid issues with flex containers.</p>
Note that <ahref="https://rtlstyling.com/posts/rtl-styling#3.-line-break">breaking words isn’t possible in Arabic</a>, which is the most used RTL language. Therefore <code>.text-break</code> is removed from our RTL compiled CSS.
</div>
<h2id="text-transform">Text transform</h2>
<p>Transform text in components with text capitalization classes.</p>
<p>Note how <code>.text-capitalize</code> only changes the first letter of each word, leaving the case of any other letters unaffected.</p>
<h2id="font-size">Font size</h2>
<p>Quickly change the <code>font-size</code> of text. While our heading classes (e.g., <code>.h1</code>–<code>.h6</code>) apply <code>font-size</code>, <code>font-weight</code>, and <code>line-height</code>, these utilities <em>only</em> apply <code>font-size</code>. Sizing for these utilities matches HTML’s heading elements, so as the number increases, their size decreases.</p>
<h2id="font-weight-and-italics">Font weight and italics</h2>
<p>Quickly change the <code>font-weight</code> or <code>font-style</code> of text with these utilities. <code>font-style</code> utilities are abbreviated as <code>.fst-*</code> and <code>font-weight</code> utilities are abbreviated as <code>.fw-*</code>.</p>
<divclass="bd-example">
<pclass="fw-bold">Bold text.</p>
<pclass="fw-bolder">Bolder weight text (relative to the parent element).</p>
<pclass="fw-normal">Normal weight text.</p>
<pclass="fw-light">Light weight text.</p>
<pclass="fw-lighter">Lighter weight text (relative to the parent element).</p>
<pclass="fst-italic">Italic text.</p>
<pclass="fst-normal">Text with normal font style</p>
<spanclass="p"><</span><spanclass="nt">p</span><spanclass="na">class</span><spanclass="o">=</span><spanclass="s">"fw-bolder"</span><spanclass="p">></span>Bolder weight text (relative to the parent element).<spanclass="p"></</span><spanclass="nt">p</span><spanclass="p">></span>
<spanclass="p"><</span><spanclass="nt">p</span><spanclass="na">class</span><spanclass="o">=</span><spanclass="s">"fw-lighter"</span><spanclass="p">></span>Lighter weight text (relative to the parent element).<spanclass="p"></</span><spanclass="nt">p</span><spanclass="p">></span>
<spanclass="p"><</span><spanclass="nt">p</span><spanclass="na">class</span><spanclass="o">=</span><spanclass="s">"fst-normal"</span><spanclass="p">></span>Text with normal font style<spanclass="p"></</span><spanclass="nt">p</span><spanclass="p">></span></code></pre></div>
<h2id="line-height">Line height</h2>
<p>Change the line height with <code>.lh-*</code> utilities.</p>
<divclass="bd-example">
<pclass="lh-1">Vivamus sagittis lacus vel augue laoreet rutrum faucibus dolor auctor. Donec sed odio dui. Cras mattis pannenkoek purus sit amet fermentum. Praesent commodo cursus magna, vel scelerisque nisl consectetur et. Nullam id dolor id nibh ultricies vehicula ut id elit. Cras mattis consectetur purus sit amet fermentum.</p>
<pclass="lh-sm">Vivamus sagittis lacus vel augue laoreet rutrum faucibus dolor auctor. Donec sed odio dui. Cras mattis pannenkoek purus sit amet fermentum. Praesent commodo cursus magna, vel scelerisque nisl consectetur et. Nullam id dolor id nibh ultricies vehicula ut id elit. Cras mattis consectetur purus sit amet fermentum.</p>
<pclass="lh-base">Vivamus sagittis lacus vel augue laoreet rutrum faucibus dolor auctor. Donec sed odio dui. Cras mattis pannenkoek purus sit amet fermentum. Praesent commodo cursus magna, vel scelerisque nisl consectetur et. Nullam id dolor id nibh ultricies vehicula ut id elit. Cras mattis consectetur purus sit amet fermentum.</p>
<pclass="lh-lg">Vivamus sagittis lacus vel augue laoreet rutrum faucibus dolor auctor. Donec sed odio dui. Cras mattis pannenkoek purus sit amet fermentum. Praesent commodo cursus magna, vel scelerisque nisl consectetur et. Nullam id dolor id nibh ultricies vehicula ut id elit. Cras mattis consectetur purus sit amet fermentum.</p>
</div><divclass="highlight"><preclass="chroma"><codeclass="language-html"data-lang="html"><spanclass="p"><</span><spanclass="nt">p</span><spanclass="na">class</span><spanclass="o">=</span><spanclass="s">"lh-1"</span><spanclass="p">></span>Vivamus sagittis lacus vel augue laoreet rutrum faucibus dolor auctor. Donec sed odio dui. Cras mattis pannenkoek purus sit amet fermentum. Praesent commodo cursus magna, vel scelerisque nisl consectetur et. Nullam id dolor id nibh ultricies vehicula ut id elit. Cras mattis consectetur purus sit amet fermentum.<spanclass="p"></</span><spanclass="nt">p</span><spanclass="p">></span>
<spanclass="p"><</span><spanclass="nt">p</span><spanclass="na">class</span><spanclass="o">=</span><spanclass="s">"lh-sm"</span><spanclass="p">></span>Vivamus sagittis lacus vel augue laoreet rutrum faucibus dolor auctor. Donec sed odio dui. Cras mattis pannenkoek purus sit amet fermentum. Praesent commodo cursus magna, vel scelerisque nisl consectetur et. Nullam id dolor id nibh ultricies vehicula ut id elit. Cras mattis consectetur purus sit amet fermentum.<spanclass="p"></</span><spanclass="nt">p</span><spanclass="p">></span>
<spanclass="p"><</span><spanclass="nt">p</span><spanclass="na">class</span><spanclass="o">=</span><spanclass="s">"lh-base"</span><spanclass="p">></span>Vivamus sagittis lacus vel augue laoreet rutrum faucibus dolor auctor. Donec sed odio dui. Cras mattis pannenkoek purus sit amet fermentum. Praesent commodo cursus magna, vel scelerisque nisl consectetur et. Nullam id dolor id nibh ultricies vehicula ut id elit. Cras mattis consectetur purus sit amet fermentum.<spanclass="p"></</span><spanclass="nt">p</span><spanclass="p">></span>
<spanclass="p"><</span><spanclass="nt">p</span><spanclass="na">class</span><spanclass="o">=</span><spanclass="s">"lh-lg"</span><spanclass="p">></span>Vivamus sagittis lacus vel augue laoreet rutrum faucibus dolor auctor. Donec sed odio dui. Cras mattis pannenkoek purus sit amet fermentum. Praesent commodo cursus magna, vel scelerisque nisl consectetur et. Nullam id dolor id nibh ultricies vehicula ut id elit. Cras mattis consectetur purus sit amet fermentum.<spanclass="p"></</span><spanclass="nt">p</span><spanclass="p">></span></code></pre></div>
<h2id="monospace">Monospace</h2>
<p>Change a selection to our monospace font stack with <code>.font-monospace</code>.</p>
<divclass="bd-example">
<pclass="font-monospace">This is in monospace</p>
</div><divclass="highlight"><preclass="chroma"><codeclass="language-html"data-lang="html"><spanclass="p"><</span><spanclass="nt">p</span><spanclass="na">class</span><spanclass="o">=</span><spanclass="s">"font-monospace"</span><spanclass="p">></span>This is in monospace<spanclass="p"></</span><spanclass="nt">p</span><spanclass="p">></span></code></pre></div>
<h2id="reset-color">Reset color</h2>
<p>Reset a text or link’s color with <code>.text-reset</code>, so that it inherits the color from its parent.</p>
<divclass="bd-example">
<pclass="text-muted">
Muted text with a <ahref="#"class="text-reset">reset link</a>.
Muted text with a <spanclass="p"><</span><spanclass="nt">a</span><spanclass="na">href</span><spanclass="o">=</span><spanclass="s">"#"</span><spanclass="na">class</span><spanclass="o">=</span><spanclass="s">"text-reset"</span><spanclass="p">></span>reset link<spanclass="p"></</span><spanclass="nt">a</span><spanclass="p">></span>.
<p>Decorate text in components with text decoration classes.</p>
<divclass="bd-example">
<pclass="text-decoration-underline">This text has a line underneath it.</p>
<pclass="text-decoration-line-through">This text has a line going through it.</p>
<ahref="#"class="text-decoration-none">This link has its text decoration removed</a>
</div><divclass="highlight"><preclass="chroma"><codeclass="language-html"data-lang="html"><spanclass="p"><</span><spanclass="nt">p</span><spanclass="na">class</span><spanclass="o">=</span><spanclass="s">"text-decoration-underline"</span><spanclass="p">></span>This text has a line underneath it.<spanclass="p"></</span><spanclass="nt">p</span><spanclass="p">></span>
<spanclass="p"><</span><spanclass="nt">p</span><spanclass="na">class</span><spanclass="o">=</span><spanclass="s">"text-decoration-line-through"</span><spanclass="p">></span>This text has a line going through it.<spanclass="p"></</span><spanclass="nt">p</span><spanclass="p">></span>
<spanclass="p"><</span><spanclass="nt">a</span><spanclass="na">href</span><spanclass="o">=</span><spanclass="s">"#"</span><spanclass="na">class</span><spanclass="o">=</span><spanclass="s">"text-decoration-none"</span><spanclass="p">></span>This link has its text decoration removed<spanclass="p"></</span><spanclass="nt">a</span><spanclass="p">></span></code></pre></div>
<pclass="mb-0">Designed and built with all the love in the world by the <ahref="/docs/5.0/about/team/">Bootstrap team</a> with the help of <ahref="https://github.com/twbs/bootstrap/graphs/contributors">our contributors</a>.</p>