Last active
September 8, 2021 01:30
Adds a pseudo-element to help vertically align text labels in buttons/block-like links without using magic numbers https://ishadeed.com/article/button-label-alignment/
This file contains 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
/// VERTICALLY ALIGN LABEL | |
/// Adds a pseudo-element to help vertically align | |
/// text labels in buttons/block-like links without | |
/// using magic numbers | |
/// More: https://ishadeed.com/article/button-label-alignment/ | |
@mixin vertically-align-label() { | |
&::before { | |
content: ''; | |
display: inline-block; | |
vertical-align: middle; | |
height: 1ex; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I just added
ex
units because using x-height for a height value feels more appropriate