Closed Bug 1530048 Opened 2 years ago Closed 2 years ago

HTML spec says tables should have `border-color:gray`, but we only do that in quirks mode


(Core :: Layout: Tables, defect, P3)




Tracking Status
firefox67 --- fixed


(Reporter: dholbert, Assigned: dholbert)





(5 files, 1 obsolete file)

The html spec says that tables should have border-color:gray:

table, td, th { border-color: gray; }

We specify that in our quirks-mode stylesheet, so we only give tables gray borders in quirks mode, but we give them black (i.e. default-color) borders in standards mode.

Here are how different browsers render the attached testcases (listing the border colors as "outer/inner", i.e. "table/td"):

                         Firefox 67     Chrome 74 and Safari 12    Edge 18 & IE11
Standards-mode colors:   black/black         gray/black              Black/Black
Quirks-mode colors:      gray/gray           gray/black              Black/Black


  • We're the only browser to have a difference based on quirks-mode.
  • We're the only browser to ever render gray borders for the td (and th) elements (though it's what the spec says we're supposed to do).
  • We have a comment saying our gray color is "for compatibility" (presumably with IE, in the old days), but Edge/IE don't have any special non-default border-coloring behavior for tables anymore (!!)

Maybe we should just get the spec updated? Given the lack of compatibility here and the agreement between Edge and Firefox (and Chrome for td/th), I'm not sure it's useful for HTML to specify a special default "border-color" for table elements that disagrees with the browser ~consensus.

It looks like our quirks-mode rule dates back to

See also bug 370833 -- the testcases on that bug are interesting (using <table border>) and seem to behave a bit differently...

And I filed and on the Chrome/Safari (Blink/WebKit) magic behavior for inset/outset cells' border colors (which is shown in the middle section of testcase 3).

Flags: needinfo?(dholbert)

This quirk was originally for compatibility with IE, but IE doesn't have this
special behavior anymore (in quirks-mode or in standards-mode).
And Blink/WebKit have yet another set of behaviors, which are also not
quirks-mode-dependent, and vary depending on the part of the table:

Try run is green, which means we don't have any test coverage for this quirk (I should probably add some before landing).

Flags: needinfo?(dholbert)
Flags: needinfo?(dholbert)
Attachment #9046610 - Attachment description: Bug 1530048: Remove quirks-mode-only UA stylesheet rule that made table borders gray. r?dbaron → Bug 1530048 part 1: Remove quirks-mode-only UA stylesheet rule that made table borders gray. r?dbaron
Assignee: nobody → dholbert
Flags: needinfo?(dholbert)
Pushed by
part 1: Remove quirks-mode-only UA stylesheet rule that made table borders gray. r=dbaron
part 2: Add test to verify that table, td, and th draw borders using 'currentColor'. r=dbaron
Closed: 2 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla67
Created web-platform-tests PR for changes under testing/web-platform/tests

The "can't merge" reason is bogus; I left a comment in the pull request.

You need to log in before you can comment on or make changes to this bug.