Created
February 19, 2017 18:12
-
-
Save attitude/0fd95ae7af26a38630cb5b56254e3a3e to your computer and use it in GitHub Desktop.
LESS CSS mixin to remove extra optical space above and below the block of text caused by how the browser distributes the line height property.
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
.remove-extra-line-height(@line-height: 1, @m-height: 0.7, @coef: 0.5) { | |
line-height: 1em * @line-height; | |
&:before, | |
&:after { | |
content: ""; | |
display: table; | |
} | |
&:before { | |
margin-bottom: ((1 - @m-height) * @coef + (@line-height - 1) / 2) * -1em; | |
} | |
&:after { | |
margin-top: ((1 - @m-height) * (1 - @coef) + (@line-height - 1) / 2) * -1em; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment