From d1ba9bfefafa89fdb128e89956e49090af09ebdf Mon Sep 17 00:00:00 2001 From: Bryce Kwon Date: Sat, 24 Oct 2026 09:17:41 -1000 Subject: Keep the code in step with its line numbers The stylesheet overhaul in 4ce57f5 gave the pre of the tree and blame pages the site's monospace font but left the code element inside it on the browser's own, Courier in Safari and DejaVu Sans Mono on a typical Linux desktop. A line box holds both fonts on one baseline, so where their ascent and descent differ each code line comes out a little taller than its number. By the end of a 2,000 line file the code sat 45 lines low in Safari and 109 in all three engines on Debian. --- assets/cgit.css | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'assets/cgit.css') diff --git a/assets/cgit.css b/assets/cgit.css index dbd807c..0d2da53 100644 --- a/assets/cgit.css +++ b/assets/cgit.css @@ -645,6 +645,14 @@ div#cgit table.blob pre { font-family: var(--font-mono); } +/* + * The code is set exactly like the line numbers beside it, since in another + * font or size each line can come out taller than its number. + */ +div#cgit table.blob code { + font: inherit; +} + div#cgit table.blob td.linenumbers a, div#cgit table.ssdiff td.lineno a { color: var(--muted); -- cgit 2.9.1