Created
September 18, 2021 09:01
-
-
Save EminQasimov/80ddcb7289d47a4d07caa1b4dc2bae83 to your computer and use it in GitHub Desktop.
safari supported line clamp css
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
.line-clamp { | |
display : block; | |
display : -webkit-box; | |
-webkit-box-orient : vertical; | |
position : relative; | |
overflow : hidden; | |
text-overflow : ellipsis; | |
padding : 0 !important; | |
line-height: var(--line-height,1.2) !important; | |
} | |
.line-clamp-1 { | |
-webkit-line-clamp : 1; | |
height : calc(1em * var(--line-height, 1.2) * 1); | |
} | |
.line-clamp-2 { | |
-webkit-line-clamp : 2; | |
height : calc(1em * var(--line-height, 1.2) * 2); | |
} | |
.line-clamp-3 { | |
-webkit-line-clamp : 3; | |
height : calc(1em * var(--line-height, 1.2) * 3); | |
} | |
.line-clamp-4 { | |
-webkit-line-clamp : 4; | |
height : calc(1em * var(--line-height, 1.2) * 4); | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment