Modern responsive web layouts frequently confront typographic challenges when long alphanumeric strings, unstructured URLs, compound German nouns, or East Asian (CJK) text strings overflow their parent containers. Without explicit line breaking rules, lengthy unsegmented text will breach column borders, disrupt grid templates, and trigger undesirable horizontal scrollbars across mobile screens.
The CSS word-break property controls where soft wraps occur within words when text reaches the boundary of an inline box. In Apple Safari on macOS and iOS, the WebKit rendering engine implements strict adherence to the CSS Text Module Level 3 specification. Utilizing Safari Web Inspector allows developers to inspect computed word breaking behaviour, simulate international typographic contexts, toggle experimental break rules dynamically, and audit visual overflow across responsive viewports.
Understanding CSS word-break Values and WebKit Engine Parsing
The word-break property defines line breaking rules specifically for non-CJK text, CJK text, and arbitrary word boundaries. Understanding the distinct behaviour of each value in WebKit ensures predictable cross-browser typography:
normal: Applies standard Unicode line breaking rules. Break points are calculated according to the Unicode Line Breaking Algorithm (UAX #14). In non-CJK scripts, words break only at hyphens or whitespace; in CJK scripts, breaking can occur between almost any two ideographs.break-all: Allows lines to break between any two characters (including non-CJK letters and digits) to prevent the string from overflowing the content box. Hyphenation marks are not inserted.keep-all: Forbids soft wrapping between ideographs in Chinese, Japanese, and Korean (CJK) text, forcing text to break only at designated whitespace characters—matching Western text conventions. For non-CJK scripts,keep-allbehaves identically tonormal.break-word: Deprecated legacy value. In modern WebKit/Safari, specifyingword-break: break-wordis computed asword-break: normalpaired withoverflow-wrap: anywhere.
Enabling Safari Web Inspector and Selecting Target Containers
To inspect line breaking and typographic layout rules in Safari on macOS:
- Launch Safari and navigate to Safari > Settings (or press
Cmd + ,). - Select the Advanced tab and ensure the checkbox Show features for web developers is selected.
- Close the Settings window. The Develop menu will now appear in the macOS menu bar.
- Navigate to your webpage, right-click the text block or parent container exhibiting overflow issues, and select Inspect Element (or press
Cmd + Option + I).
The Safari Web Inspector interface opens, highlighting the target node in the Elements DOM tree hierarchy.
Inspecting Computed Rules and Cascading Style Overrides
Once the element is selected in the DOM tree, navigate to the Styles sidebar on the right pane of Web Inspector.
To audit active word break declarations:
- Look through the cascading rules applied to the selector. If
word-breakis declared in a CSS class or reset stylesheet, check whether it is struck through (indicating that a higher-specificity rule or inline style overrides it). - Switch to the Computed sub-tab within the Styles panel.
- Type
word-breakinto the search filter field. Web Inspector displays the final resolved property value applied by the WebKit rendering engine, along with a link to the exact stylesheet and line number where the winning declaration originates.
If you see unexpected wrapping, check related properties in the Computed panel such as overflow-wrap (or word-wrap), white-space, and hyphens, as conflicting values (like white-space: nowrap) completely suppress word-break calculations.
Testing and Simulating Values Dynamically in Safari
You can adjust word break rules live in the browser without editing source files or recompiling assets. This is particularly useful for verifying whether break-all disrupts English readability or whether keep-all properly aligns Korean poetry or technical documentation.
To test property variations live in Web Inspector:
- In the Styles panel, click directly inside the declaration block of your target CSS selector (or click the
+icon in the header to create a new style rule). - Type
word-break:and observe the auto-complete dropdown offered by WebKit. - Select
break-allto test tight container wrapping for unspaced technical strings:.technical-hash, .table-cell-url { word-break: break-all; } - Observe the viewport immediately. Characters will wrap cleanly at the container boundary rather than extending beyond the border.
- To test CJK presentation where ideographs should remain bound together within phrases, test
keep-all:.cjk-heading { word-break: keep-all; }
Use the checkboxes adjacent to each rule in Web Inspector to toggle declarations on and off, comparing layout reflow instantaneously.
Differentiating word-break from overflow-wrap and hyphens
A common layout mistake in front-end design is using word-break: break-all when overflow-wrap: break-word is actually intended. Safari Web Inspector helps visualize the difference between these properties:
| Property & Value | WebKit Wrapping Behaviour | Primary Use Case |
|---|---|---|
word-break: normal |
Standard dictionary breaks; CJK breaks at ideographs; Latin text breaks at spaces. | Default standard web prose. |
word-break: break-all |
Forces breaks between any two characters at the line boundary, even inside Latin words. | Long hashes, API keys, URLs, terminal outputs. |
word-break: keep-all |
Suppresses soft breaks between CJK characters unless a space is present. | Korean typographic precision and CJK headline design. |
overflow-wrap: break-word |
Only breaks a word if the entire word cannot fit on a single line by itself. | Paragraphs containing occasional long strings or URLs. |
hyphens: auto |
Breaks words at language-specific hyphenation syllables, inserting a hyphen glyph. | Justified body copy and editorial multi-column layouts. |
In Web Inspector, you can verify whether an element benefits more from overflow-wrap: anywhere or word-break: break-all by resizing the container with responsive design mode.
Auditing Responsive Breakpoints with Responsive Design Mode
To inspect how word breaks behave across varying screen widths on Apple devices:
- In Safari, press
Cmd + Ctrl + R(or select Develop > Enter Responsive Design Mode). - Select an iPhone or iPad viewport simulation, or drag the viewport handles horizontally.
- Observe whether narrow mobile widths cause awkward mid-word breaks when
break-allis active, or trigger horizontal viewport scrolling whenkeep-allis active without appropriate media query overrides. - If responsive overflow occurs, configure a fluid breakpoint in your CSS:
/* Use normal wrapping with overflow-wrap fallback on standard displays */ .article-content { word-break: normal; overflow-wrap: anywhere; } /* Enforce break-all strictly on ultra-narrow viewports for code and metadata */ @media (max-width: 480px) { .code-snippet, .user-id-string { word-break: break-all; } }