How to Inspect and Control CSS text-justify and CJK Justification in Safari Web Inspector

In high-end editorial typography and international web design, full justification (aligning text flush against both left and right container margins simultaneously) requires sophisticated spacing algorithms. In Western scripts (Latin, Cyrillic, and Greek), justification is traditionally accomplished by expanding or condensing the whitespace between words. However, in East Asian writing systems—including Chinese, Japanese, and Korean (CJK)—words are not separated by whitespace characters; instead, ideographic glyphs occupy uniform em-square boxes. Applying standard Western word-spacing justification to CJK text produces unsightly gaps or fails completely. The CSS text-justify property controls the precise algorithmic method used when text-align: justify is applied. Supported across Apple’s WebKit rendering engine in Safari, Web Inspector provides specialized tools to inspect computed justification algorithms, test inter-character expansion, and verify multi-lingual typography.

Understanding CSS text-justify Values and Algorithms

The text-justify property is evaluated by the browser only when text-align: justify is active. It supports the following standardized values:

  • auto (default): The browser engine chooses the justification algorithm based on the writing system and language context declared via the HTML lang attribute.
  • inter-word: Justification is achieved strictly by expanding or compressing whitespace between words. Character spacing within words remains fixed. This is the optimal typographic standard for English and European languages.
  • inter-character: Justification distributes extra space evenly between individual characters or ideographic glyphs, in addition to adjusting whitespace. This is the mandatory typographical standard for Chinese and Japanese text.
  • none: Disables justification adjustments completely, behaving effectively like text-align: start.

A typical CSS rule set ensuring proper justification across multi-lingual articles appears as follows:

/* Western editorial justification: space between words */
:lang(en) .editorial-copy {
  text-align: justify;
  text-justify: inter-word;
  hyphens: auto;
}

/* East Asian justification: space between ideographic characters */
:lang(ja) .editorial-copy,
:lang(zh) .editorial-copy {
  text-align: justify;
  text-justify: inter-character;
}

Enabling Developer Tools in Safari

To inspect typography rules in Safari on macOS:

  1. Launch Safari and navigate to Safari > Settings (or press Cmd + ,).
  2. Select the Advanced tab and ensure Show features for web developers is checked.
  3. Open your target webpage in Safari.
  4. Right-click on the justified text element and select Inspect Element, or press Option + Cmd + I.

Inspecting and Modifying text-justify in Elements Panel

When Safari Web Inspector opens, navigate to the Elements tab. Locate your target paragraph or article block in the DOM hierarchy.

Validating Applied Justification Rules

  1. Select the text container (e.g., <p class="editorial-copy">) in the DOM tree.
  2. In the Styles panel, verify that text-align: justify is active. If text-align evaluates to left, right, or start, the browser ignores text-justify completely.
  3. Locate the text-justify declaration in the Styles pane.
  4. Switch to the Computed panel to verify that WebKit’s layout engine has resolved text-justify: inter-character or inter-word as the active cascading value.

Interactively Comparing inter-word vs inter-character

To observe how the WebKit layout engine recalculates typographic spacing in real time:

  • Double-click the text-justify declaration in the Styles panel.
  • Change inter-word to inter-character on a block of Latin text. Notice how WebKit introduces micro-spacing between individual letters inside English words (often referred to as tracking expansion), which can look awkward in Western typography but illustrates how the character-spacing engine functions.
  • Change the value back to inter-word to restore natural English word spacing.
  • On a block of Japanese or Chinese text, set text-justify: inter-character. Observe how ideographic characters align smoothly to both column edges without disrupting vertical text rhythm.

Debugging “Rivers of White” in Narrow Columns

In narrow responsive columns (such as mobile viewports), full justification in English often creates large, irregular vertical gaps between words—known typographically as “rivers of white”.

To diagnose and resolve justification spacing anomalies in Safari Web Inspector:

  1. Inspect the justified container and resize Safari’s window or use Responsive Design Mode (Ctrl + Cmd + R).
  2. If wide word gaps emerge, pair text-justify: inter-word with automated hyphenation in the Styles panel:
    hyphens: auto;
  3. WebKit automatically inserts soft hyphens at syllable boundaries, dramatically reducing word spacing variances and smoothing column margins.

Auditing CJK Mixed-Script Typography (Bilingual Copy)

When articles mix Chinese or Japanese text with English product names or Latin numerals, WebKit uses script-aware boundary detection. In text-justify: inter-character mode, WebKit distributes space between CJK glyphs while keeping Latin word boundaries intact.

Verify that your HTML markup declares proper language attributes (<html lang="ja">) so that WebKit’s layout engine activates culturally authentic glyph spacing rules.

By leveraging Safari Web Inspector to inspect computed justification properties, test inter-word and inter-character algorithms, and coordinate hyphenation rules, front-end engineers can achieve immaculate, professional typography across multi-lingual web applications.

Get the best tech tips delivered straight to your inbox.

Join thousands of readers mastering Apple, Google, Microsoft, and Linux.