Skip to content

Commit 693ab6a

Browse files
committed
Fix alignment for svg icons
1 parent cccd964 commit 693ab6a

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

sass/style.scss

+7-1
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,13 @@ figure {
9797
.svg-icon {
9898
width: 1em;
9999
height: 1em;
100-
vertical-align: middle;
100+
// See: https://tonsky.me/blog/centering/#what-can-be-done-web-developers
101+
// > [...] Now that we have that sorted, aligning icons is not that hard too.
102+
// > You set `vertical-align: baseline` and then move them down by `(iconHeight - capHeight) / 2`.
103+
// This works because we use Inter, a font that follows
104+
// the rule `ascender − cap-height = descender`, yayy :)
105+
vertical-align: baseline;
106+
transform: translateY(calc((1em - 1cap) / 2));
101107
}
102108

103109
.social-links {

0 commit comments

Comments
 (0)