Re: [csswg-drafts] [html] Change default <sup> and <sub> styling?

While that is indeed better typography, and I would be happy to switch to that if we could, I don't think this is OK in terms of compat (and semantics) because the possibility of nested sub/sup. While these are not overly common it does exist, and this style change is would induce a rendering with apparently different semantics.

Consider:
```html
2<sup>2<sup>2</sup></sup> = 16
```
This correctly, even if the typography isn't great looks like 2^2^2 = 16 with the legacy styling, but would look like 2^22=16 with the proposed change, which is wrong.

I think we can strike a good balance between good typography and good compat by combining the two, using the proposed approach for the first level, and the original one for nesting:

```css
sub { font-variant-position: sub; }
sup { font-variant-position: super; }

:matches(sub, sup) :matches(sub, sup) {  font-size: smaller; }
/* Not using :matches() on the parent in the following 2 rules is intentional,
   it would shift too much. */
sub sub { vertical-align: sub; }
sup sup { vertical-align: super; }
```

The result is better in the non nested case, and not obviously better or worse in the case of nested subs or nested sups the nested case. It does arguably become somewhat worse when instead of nesting multiple sub or multiple sup, we nest sub in sup or vice versa, but it remains understandable, and that's a pretty rare.


-- 
GitHub Notification of comment by frivoal
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/1888#issuecomment-337445025 using your GitHub account

Received on Wednesday, 18 October 2017 02:49:25 UTC