Text Alignment
Text alignment utilities set text-align. They are for text blocks, not for
laying out flex items; use Alignment for that.
Classes
Section titled “Classes”| Class | text-align |
|---|---|
text-left |
left |
text-center |
center |
text-right |
right |
text-justify |
justify |
text-start |
start |
text-end |
end |
text-start and text-end follow the writing direction; text-left and
text-right are physical. Prefer the logical pair in bilingual layouts.
<p class="text-center">Centered caption</p><p class="text-end">Right-aligned price</p>Responsive alignment
Section titled “Responsive alignment”<h1 class="text-center text-md-start">Centered on phones, left on wider screens</h1>Responsive: text-sm-center … text-2xl-justify.
These classes are in the separate responsive module: import
nightcss/utilities/responsive after the base bundle, or use
nightcss/full.
Guidance
Section titled “Guidance”- Left-aligned body copy is the safest default in left-to-right languages.
- Reserve
text-centerfor short lines: captions, empty states, and hero copy. text-justifyneeds a language with predictable word spacing and hyphenation. Withouthyphens, it can open large gaps between words.- Do not center long paragraphs; ragged right is easier to read.