Skip to content

Text Alignment

Text alignment utilities set text-align. They are for text blocks, not for laying out flex items; use Alignment for that.

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

  • Left-aligned body copy is the safest default in left-to-right languages.
  • Reserve text-center for short lines: captions, empty states, and hero copy.
  • text-justify needs a language with predictable word spacing and hyphenation. Without hyphens, it can open large gaps between words.
  • Do not center long paragraphs; ragged right is easier to read.