1
0
mirror of https://github.com/danbee/danbarber.me.hugo.git synced 2025-03-04 08:59:18 +00:00

Tweak font size and fix font scaling in Safari

Safari does not resize the text as the viewport is resized. This hack
gets around that by forcing a repaint on every frame. This does not seem
to impact the browsers CPU usage at all.

One interesting issue is that Safari snaps the font sizes to the
nearest pixel size, so the font sizes tend to jump around a little,
rather than scaling smoothly like Firefox/Chrome.
This commit is contained in:
Daniel Barber 2019-10-20 23:05:54 -04:00
parent 88b5dec182
commit 3c387ef9cf
2 changed files with 20 additions and 2 deletions

View File

@ -2,7 +2,7 @@ html {
background-color: $background-color;
color: $text-color;
font-family: $body-font-family;
font-size: calc(0.85vmin + 13px);
font-size: calc(1vmin + 13px);
font-style: normal;
font-weight: 300;
line-height: 1.4;
@ -12,3 +12,13 @@ html {
color: $text-color-dark;
}
}
_:default:not(:root:root),
html {
animation: webkitfix 1s forwards infinite;
}
@-webkit-keyframes webkitfix {
100% {
z-index: auto;
}
}

View File

@ -349,7 +349,7 @@ html {
background-color: #fff;
color: #333;
font-family: "Mercury SSm A", "Mercury SSm B", serif;
font-size: calc(0.85vmin + 13px);
font-size: calc(1vmin + 13px);
font-style: normal;
font-weight: 300;
line-height: 1.4; }
@ -358,6 +358,14 @@ html {
background-color: #282828;
color: #ddd; } }
_:default:not(:root:root),
html {
animation: webkitfix 1s forwards infinite; }
@-webkit-keyframes webkitfix {
100% {
z-index: auto; } }
pre {
overflow: auto;
background: black;