jensimmons / cssremedy

Start your project with a remedy for the technical debt of CSS.
Mozilla Public License 2.0
2.2k stars 113 forks source link

Opt out of `monospace` font-size quirk #93

Open danburzo opened 1 year ago

danburzo commented 1 year ago

With default browser styles, markup like this:

<p>The results are saved to <code style='font-size: 1em'>localStorage</code>.</p>

Will produce a font size of 16px for the paragraph (depending on user preference) and a reduced size for <code> (13px). Normalize.css has solved this with:

pre, code, kbd, samp {
  font-family: monospace, monospace;
}

...which is functionally equivalent but bypasses the quirk (which seems to be contained to a computed value of monospace), without inventing any bogus font name that may produce a collision in thee future. I think the solution is a good candidate for cssremedy.