Last active
March 24, 2020 14:56
-
-
Save gavinmcfarland/b1dfb1344c947bfaf63fb23cfcae2414 to your computer and use it in GitHub Desktop.
For removing spacing above and below the first and last lines of a block of text
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
| * { | |
| --cap-height: 0.75; | |
| --leading-trim-over-adjustment: 0em; | |
| --leading-trim-under-adjustment: 0em; | |
| --line-height: 1.5; | |
| --unset: unset; | |
| --leading-trim: var(--unset); | |
| --leading-trim-over: var(--unset); | |
| --leading-trim-under: var(--unset); | |
| } | |
| ::before, ::after { | |
| display: block; | |
| } | |
| ::before { | |
| content: var(--leading-trim, var(--leading-trim-over, unset)); | |
| margin-bottom: calc((var(--cap-height) - var(--line-height, 1)) * 0.5em - var(--leading-trim-over-adjustment)); | |
| } | |
| ::after { | |
| content: var(--leading-trim, var(--leading-trim-under, unset)); | |
| margin-top: calc((var(--cap-height) - var(--line-height, 1)) * 0.5em - var(--leading-trim-under-adjustment)); | |
| } | |
| .leading-trim { | |
| --leading-trim: ''; | |
| line-height: var(--line-height); | |
| } | |
| .leading-trim-over { | |
| --leading-trim-over: ''; | |
| line-height: var(--line-height); | |
| } | |
| .leading-trim-under { | |
| --leading-trim-under: ''; | |
| line-height: var(--line-height); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment