Last active
October 21, 2020 08:13
-
-
Save 6ui11em/6631c770540e37862c8722ac9bd806ba to your computer and use it in GitHub Desktop.
CSS: Bold on Hover without layout shift #css #scss #bold #hover
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
By Ryan Mulligan | |
Source: https://css-tricks.com/bold-on-hover-without-the-layout-shift/ | |
*/ | |
.menu-link { | |
display: inline-flex; | |
flex-direction: column; | |
align-items: center; | |
justify-content: space-between; | |
padding: 1rem 1.5rem; | |
color: black; | |
text-decoration: none; | |
&:hover { | |
font-weight: var(--bold); | |
} | |
} | |
.menu.fix .menu-link::after { | |
content: attr(data-text); | |
content: attr(data-text) / ""; | |
height: 0; | |
visibility: hidden; | |
overflow: hidden; | |
user-select: none; | |
pointer-events: none; | |
font-weight: var(--bold); | |
@media speech { | |
display: none; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment