Skip to content

Commit

Permalink
Use ems for monospace elements
Browse files Browse the repository at this point in the history
Previously, enough.css used the rem unit to decrease the size of
monospace fonts. It chose rems because that prevented code elements
inside of pre blocks to be rendered smaller than elements without it.
However, that approach also caused code elements in headings to be
rendered at 0.8 rems, which is strange for a 2.0 rem headline.

Instead of the previous approach, use a 0.8 em font size for all code
blocks, but add an exception for code elements nested within pre
blocks.
  • Loading branch information
jeffkreeftmeijer committed May 14, 2024
1 parent 3180f29 commit f73d399
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 3 deletions.
9 changes: 8 additions & 1 deletion enough.css
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,18 @@ img, video{
}

code, kbd, pre{
font-size: 0.8rem;
font-family: ui-monospace, monospace;
font-size: 0.8em;
}

pre {
overflow: auto;
}

pre > code{
font-size: 1em;
}

table{
border-collapse: collapse;
width: 100%;
Expand Down
9 changes: 8 additions & 1 deletion enough.css.org
Original file line number Diff line number Diff line change
Expand Up @@ -87,9 +87,16 @@ Code, either in =<code>= tags, =<kbd>= tags, or =<pre>= blocks, uses a different
#+begin_src css
code, kbd, pre{
font-family: ui-monospace, monospace;
font-size: 0.8rem;
font-size: 0.8em;
}

pre {
overflow: auto;
}

pre > code{
font-size: 1em;
}
#+end_src

Enough.css switches code elements to the /ui-monospace/ font family, which is Apple's /SF Mono/ font in Safari on macOS and iOS.
Expand Down
2 changes: 1 addition & 1 deletion enough.min.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit f73d399

Please sign in to comment.