From eb4c4330f7fc44e5ffe730ddb6234ea2bd10a5cc Mon Sep 17 00:00:00 2001 From: Gabriel Augendre Date: Sat, 10 Apr 2021 15:34:06 +0200 Subject: [PATCH] Fix code scrolling due to line numbers --- articles/static/code.css | 15 ++++++++++++++- articles/static/public.css | 6 +++++- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/articles/static/code.css b/articles/static/code.css index fb1b8b2..519ac8b 100644 --- a/articles/static/code.css +++ b/articles/static/code.css @@ -1,3 +1,9 @@ +:root { + --linenos-width: 55px; + --code-border-width: 1px; + --pre-padding-horizontal: 1.5rem; +} + .codehilitetable td { border: none; margin: 0; @@ -5,7 +11,9 @@ } .codehilitetable .linenos { - max-width: 20px; + width: var(--linenos-width); + min-width: var(--linenos-width); + max-width: var(--linenos-width); } .codehilitetable .linenos pre { @@ -13,6 +21,8 @@ border-top-right-radius: 0; border-bottom-right-radius: 0; padding-right: 0; + margin-bottom: 0; + overflow-x: scroll; } .codehilitetable .code pre { @@ -20,4 +30,7 @@ border-top-left-radius: 0; border-bottom-left-radius: 0; padding-left: .1rem; + margin-bottom: 0; + width: calc(var(--body-width) - var(--linenos-width) - 2 * var(--code-border-width) - var(--pre-padding-horizontal)); + overflow-x: scroll; } diff --git a/articles/static/public.css b/articles/static/public.css index ef41fe2..41fde9b 100644 --- a/articles/static/public.css +++ b/articles/static/public.css @@ -1,6 +1,10 @@ +:root { + --body-width: 750px; +} + body { /* Overriding so that it doesn't change even when updating the library. */ - max-width: 750px; + max-width: var(--body-width); } h1, h2, h3 {