sup/sub elements are aligned differently in Chrome and Firefox with line-height and vertical-align.
Categories
(Core :: Layout: Block and Inline, defect, P3)
Tracking
()
| Tracking | Status | |
|---|---|---|
| firefox67 | --- | fixed |
People
(Reporter: twisniewski, Assigned: twisniewski)
References
Details
(Whiteboard: [webcompat])
Attachments
(2 files)
It appears that Firefox and Chrome treat vertical-align:top differently for <sup> and <sub> tags with a tall line-height, as per the attached test-case.
Firefox aligns them to the top of the line-box, while Chrome aligns them as though they are inline elements (that is, as though vertical-align is no longer super).
Moreover, this only seems to happen with <sup> and <sub> tags. When I try a <span> that is inline or inline-block, both browsers render them similarly.
This is causing asterisks to appear too far up above their text on Deviant Art's age-consent form, as seen at https://webcompat.com/issues/25032
| Assignee | ||
Updated•7 years ago
|
Comment 1•7 years ago
|
||
This is because of line-height: normal on the UA sheet for sup. If you apply line-height: normal to the sup it behaves the same in Chrome.
So it's a matter of removing:
(And from the relevant sub rule I guess), and ensuring there's no fallout.
Maybe you're interested in giving it a shot?
Comment 2•7 years ago
|
||
Also we should check if WebKit does something different I guess, though seems unlikely.
Updated•7 years ago
|
| Assignee | ||
Comment 3•7 years ago
•
|
||
Also we should check if WebKit does something different
I just checked, and Safari on OSX renders as Chrome does.
Maybe you're interested in giving it a shot?
Sure, I'll try to find time between webcompat diagnoses :)
| Assignee | ||
Comment 4•7 years ago
|
||
| Assignee | ||
Comment 5•7 years ago
|
||
drop line-height:normal rule in html.css for <sub> and <sup> for interop.
| Assignee | ||
Comment 6•7 years ago
|
||
I'm not seeing anything worrying on that try-run, so I've gone ahead and requested review.
I'm not sure if we want to add a test-case for this or not? If so, should I be using a reftest with the Ahem font?
Comment 7•7 years ago
|
||
No need to use ahem, just a reftest like your test-case that renders the same as the same file but with <sub style="line-height: inherit"> / <sup style="line-height: inherit"> should be fine.
Updated•7 years ago
|
| Assignee | ||
Comment 8•7 years ago
|
||
Alright, I've added a reftest and updated the commit message to be a bit clearer. I'm doing another try-run here just in case: https://treeherder.mozilla.org/#/jobs?repo=try&revision=01ad672ce22b31ed466a99c447500a977f8ebd90
Comment 10•7 years ago
|
||
| bugherder | ||
Description
•