How to Inspect and Control CSS border-collapse in Data Tables in Safari Web Inspector

In modern web application design, enterprise dashboards, financial ledgers, and responsive reporting tools, tabular data presentation represents a critical interface component. While modern CSS provides Grid and Flexbox for page layout, standard HTML <table> elements remain the semantic standard for complex datasets requiring accessible column headers, sorted rows, and dense gridlines. The foundational visual behaviour of any HTML data table is dictated by the CSS border-collapse property. Controlling whether table cells maintain independent, separated borders or merge into a unified, shared border grid fundamentally alters table geometry, cell padding boundaries, and border conflict resolution rules. Using Safari Web Inspector on macOS, front-end developers can inspect table border models, diagnose double-line border defects, and resolve cell border conflicts in real time.

Understanding CSS Border Models: separate vs collapse

The border-collapse property defines which table border rendering model the WebKit engine applies to a <table> element:

  • border-collapse: separate (Default): The browser renders each cell (<td> and <th>) as an isolated box with its own independent borders. Space between adjacent cell borders is governed by the border-spacing property. Properties such as empty-cells only function when separate is active.
  • border-collapse: collapse: Adjacent cell borders are merged into a single, shared border. The border-spacing and empty-cells properties are ignored. When adjacent cells declare different border styles, widths, or colors, WebKit executes the formal CSS Border Conflict Resolution Algorithm to determine which border is painted.

Configuring Safari Web Inspector for Data Table Inspection

To inspect and audit data tables in Safari on macOS, ensure Developer Features are enabled:

  1. Launch Safari on macOS.
  2. Open Settings from the menu bar or press Cmd + ,.
  3. Select the Advanced tab.
  4. Enable Show features for web developers.
  5. Right-click the data table on your target webpage and choose Inspect Element.

Inspecting Table Declarations in the Elements and Styles Panels

In Safari Web Inspector’s Elements tab, select the root <table> element in the DOM tree.

Consider the following standard financial data table styling pattern:

table.financial-report {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.95rem;
}

table.financial-report th,
table.financial-report td {
    padding: 10px 14px;
    border: 1px solid #d2d2d7;
}

table.financial-report th {
    background-color: #f5f5f7;
    font-weight: 600;
}

In the right-hand inspection sidebar, select the Styles panel:

  1. Locate the border-collapse: collapse declaration on the table selector.
  2. Click the checkbox adjacent to the rule to toggle it off.
  3. Notice that the table immediately reverts to the separate model, displaying double border lines between cells separated by the browser’s default 2px cell spacing.

Debugging the Border Conflict Resolution Algorithm

Under border-collapse: collapse, when two adjacent cells—or a cell and a table column—declare conflicting border properties along their shared edge, WebKit applies strict precedence rules:

  1. border-style: hidden: Takes supreme precedence. If any adjoining cell declares border-style: hidden, no border is rendered, regardless of other widths.
  2. border-style: none: Has the lowest precedence. If all adjoining borders are none, no border renders; otherwise, any defined style overrides it.
  3. Border Width: The thicker border wins. A 2px solid #000 border overrides an adjacent 1px solid #000 border.
  4. Border Style Priority: If widths are identical, styles resolve according to standard priority: double > solid > dashed > dotted > ridge > outset > groove > inset.
  5. Element Hierarchy Priority: If style and width are identical, border priority follows document hierarchy: Cell (td/th) > Row (tr) > Row Group (thead/tbody) > Column (col) > Column Group (colgroup) > Table (table).

In Safari Web Inspector, select individual <td> and <th> nodes to inspect computed styles in the Computed tab to determine which rule won the border conflict.

Auditing Fixed Column Headers and Sticky Borders

When implementing sticky table headers (position: sticky; top: 0 on <th> elements) within scrollable table containers, border-collapse: collapse can introduce visual glitches where borders disappear or shear during scrolling in WebKit.

To fix sticky header border shearing while maintaining clean single-pixel borders:

table.sticky-table {
    border-collapse: separate;
    border-spacing: 0;
}

table.sticky-table th {
    position: sticky;
    top: 0;
    background: #ffffff;
    border-bottom: 2px solid #0070c9;
}

By using border-collapse: separate with border-spacing: 0, Safari treats each header as an independent compositing layer, ensuring that borders stay pinned smoothly with zero flickering or misalignment during scrolling.

Get the best tech tips delivered straight to your inbox.

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