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 8d4daff253
commit 240af563ac

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;
}
}