Fix font size for [src] links in headers by GuillaumeGomez · Pull Request #92404 · rust-lang/rust (original) (raw)
Thanks for fixing this! This is also mentioned in some of the readability / accessibility threads around styling - that the [src]
link is slightly bigger than the heading, for instance in method headings.
I think the actual fix is not quite right - it's providing overrides on top of overrides on top of overrides. What we want is to set the font size at the correct level and then avoid overriding it. Also, our heading sizes are 1em, 1.1em, 1.15em, 1.3em, 1.4em, 1.5em. 1.1em corresponds to 17.6px, so setting srclink to 17px is still not quite exactly right.
One of the problems here: Typically we'd like to set the font size on the h3
and indeed we do. But the h3
and the srclink
are siblings, rather than srclink being a child of h3
.
That means we should set the font size on the parent element. So for instance the outer div here:
And the outer div here:
Then we can remove the overrides of font-size for h3.code-header and h4.code-header:
h3.code-header {
font-size: 1.1em;
}
h4.code-header {
font-size: 1em;
}
Replacing them with (I think) font-size: inherit
so they get the font-size of their div parent rather than the global h3 / h4 font size.
Alternately, maybe we shouldn't set a "global" h3 / h4 font size, but should have a set of font sizes for prose headings, and a separate set of font sizes for code headers, so they don't conflict.