From 110cf961113af9d5386cd9ba35404161e473e39b Mon Sep 17 00:00:00 2001 From: Zhiming Wang Date: Fri, 17 Jul 2015 21:27:52 -0700 Subject: fix line number placement Global font size in each style sheet has been tweaked very carefully so that the precise line height is very close to a whole number of pixels, so that precision alignment using em, which aligns something precise (top: 13.5em) to something inprecise (line heights, with accumulated errors due to rounding in every line), is not lost. Note that Firefox is NOT supported, since each line seems to always occupy one more pixel than the calculated line height. For some reason line numbers in the print view are still rather problematic at a page continuation. In Chrome and Safari, the first two line numbers on a new page tend to overlap, so everything afterwards are off (and on Firefox line numbers do not show up on the second page at all). Anyway, printing shouldn't be a big concern. --- source/css/print.css | 2 +- source/css/theme-enlarge.css | 2 +- source/css/theme.css | 7 ++++--- 3 files changed, 6 insertions(+), 5 deletions(-) (limited to 'source') diff --git a/source/css/print.css b/source/css/print.css index 392281ea..298d0677 100644 --- a/source/css/print.css +++ b/source/css/print.css @@ -1,5 +1,5 @@ body { - font-size: 8pt; + font-size: 7.936pt; } article { diff --git a/source/css/theme-enlarge.css b/source/css/theme-enlarge.css index 7fbfb203..64701d96 100644 --- a/source/css/theme-enlarge.css +++ b/source/css/theme-enlarge.css @@ -1,5 +1,5 @@ body { - font-size: 20pt; + font-size: 20.147pt; } nav div.logo { diff --git a/source/css/theme.css b/source/css/theme.css index bd34d434..5827609d 100644 --- a/source/css/theme.css +++ b/source/css/theme.css @@ -1,7 +1,7 @@ body { color: #333; font-family: "PT Serif", serif; - font-size: 11pt; + font-size: 10.99pt; } nav { @@ -90,13 +90,14 @@ pre[class*=sourceCode] { pre code { font-size: 0.91em; + line-height: 135%; } .line-number { position: absolute; left: 0; right: 0; - margin-top: 1em; + margin-top: 0.8em; pointer-events: none; white-space: pre; } @@ -108,7 +109,7 @@ pre code { left: .5em; min-width: 2em; color: #ccc; - font: 500 65%/1.5 sans-serif; + font-size: 0.65em; text-align: center; vertical-align: .3em; } -- cgit v1.2.1