How to Inspect and Control CSS text-underline-offset in Safari Web Inspector

Delivering elegant web typography requires balancing legibility, visual hierarchy, and optical balance. For decades, styling hyperlinks on the web meant enduring clunky, tight underlines that collided with letterform descenders—such as the tails of ‘g’, ‘j’, ‘p’, ‘q’, and ‘y’—creating messy visual collisions that degraded reading flow. Web designers often resorted to fragile border or background hacks to offset underlines, but these workarounds lacked native accessibility semantics and broke when text wrapped across multiple lines. The CSS Text Decoration Module Level 4 introduces the text-underline-offset property, providing direct typographic control over the vertical distance between text baseline and underline strokes. In Safari (WebKit) on macOS and iOS, developers can inspect, simulate, and refine underline spacing in real time using Safari Web Inspector.

Understanding text-underline-offset and Related Decoration Properties

Modern CSS decouples text decoration into distinct, independent typographic properties:

  • text-underline-offset: Sets the vertical distance between the text baseline and the underline stroke. It accepts length values (e.g. 0.2em, 3px, 15%) or the keyword auto (where the font file’s internal metrics dictate placement).
  • text-decoration-thickness: Controls the stroke weight of the underline (e.g. from-font, 1.5px, 0.08em).
  • text-decoration-color: Controls the stroke tint, allowing subtle or muted underline colors that do not overpower the foreground text.
  • text-decoration-skip-ink: Dictates whether the underline breaks around descenders (auto) or passes continuously through letter stems (none).

Configuring Refined Typographic Underlines in CSS

To produce modern, optically balanced hyperlink underlines that never collide with font descenders, combine relative unit offsets with skip-ink controls:

/* Refined editorial link styling */
a {
  color: #0071e3;
  text-decoration-line: underline;
  text-decoration-color: rgba(0, 113, 227, 0.4); /* Muted stroke tint */
  text-decoration-thickness: 1.5px;
  text-underline-offset: 0.25em;                   /* Decouple from baseline */
  text-decoration-skip-ink: auto;                 /* Clear descenders elegantly */
  transition: text-decoration-color 0.2s ease, text-underline-offset 0.2s ease;
}

/* Dynamic hover effect expanding offset slightly */
a:hover {
  text-decoration-color: #0071e3;
  text-underline-offset: 0.35em;
}

Using 0.25em ensures that as font sizes scale responsively across headings and body text, the underline offset scales proportionally with the font’s em-box.

Inspecting text-underline-offset in Safari Web Inspector

To audit underline spacing using Safari Web Inspector on macOS:

  1. Open Safari and load your web application or editorial layout.
  2. Press Option + Command + I to open Safari Web Inspector.
  3. In the Elements tab, select a hyperlink or underlined text DOM node.
  4. In the right-hand sidebar, open the Styles panel.
  5. Verify that text-underline-offset is applied to the active rule.
  6. Switch to the Computed panel and search for text-underline-offset to view the resolved pixel value calculated by WebKit’s text layout engine.

Tuning Optical Spacing Live in the Styles Pane

Safari Web Inspector allows live editing of CSS values to preview how font descenders interact with underline strokes:

  1. In the Styles panel, locate the text-underline-offset declaration.
  2. Click the numerical value (e.g. 0.25em).
  3. Use the Up Arrow and Down Arrow keys on your keyboard to increment or decrement the offset in real time.
  4. Observe words containing deep descenders (such as “typography” or “jumping”). Notice how setting the offset between 0.2em and 0.3em moves the line below descender tails, creating a clean reading channel.
  5. Toggle text-decoration-skip-ink: none vs auto in the inspector to observe how WebKit either clips the line around descender glyphs or draws a continuous line beneath them.

Managing Variable Font Metrics and CJK Scripts in Safari

Different typefaces define vastly different baseline metrics. For instance, geometric sans-serif fonts often have low x-heights, while serif fonts have long descenders.

In Safari Web Inspector’s Fonts panel:

  1. Inspect the active font family loaded by the browser.
  2. If switching between English and non-Latin scripts (such as Chinese, Japanese, or Arabic), observe that text-underline-offset: auto resolves differently based on font metadata.
  3. To maintain visual consistency across multilingual body text, define font-specific offsets using CSS custom properties:
    .serif-content {
      --link-offset: 0.3em;
    }
    
    .sans-content {
      --link-offset: 0.2em;
    }
    
    a {
      text-underline-offset: var(--link-offset, 0.25em);
    }

Mastering text-underline-offset and verifying optical clearance in Safari Web Inspector elevates web typography, creating crisp, legible, and modern link presentations across Apple devices.

Get the best tech tips delivered straight to your inbox.

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