From 8de86212516cf605c3e2e68f3f93699d0a1f0093 Mon Sep 17 00:00:00 2001 From: Bryce Kwon Date: Thu, 22 Oct 2026 18:56:56 -1000 Subject: Keep the code in step with its line numbers The stylesheet overhaul in 722524b 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 with Courier and 109 with DejaVu Sans Mono. --- assets/cgit.css | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'assets') 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.12.1