From af32723e52577ec14c22156256c5f73a6ebddcb9 Mon Sep 17 00:00:00 2001 From: Johannes Meyer Date: Tue, 8 Aug 2023 15:57:10 +0200 Subject: [PATCH] mixins: Add `line-clamp()` and `text-ellpsis()` --- asset/css/mixin/mixins.less | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/asset/css/mixin/mixins.less b/asset/css/mixin/mixins.less index 3f2f107d..4729c494 100644 --- a/asset/css/mixin/mixins.less +++ b/asset/css/mixin/mixins.less @@ -18,3 +18,25 @@ -moz-box-shadow: @arguments; box-shadow: @arguments; } + +.line-clamp(@numOfLines: 2) when (@numOfLines > 1) { + display: -webkit-box; + -webkit-line-clamp: @numOfLines; + -webkit-box-orient: vertical; +} +.line-clamp(@numOfLines: 2) when (@numOfLines = "reset") { + display: revert; + -webkit-line-clamp: initial; + -webkit-box-orient: initial; +} + +.text-ellipsis() { + white-space: nowrap; + overflow: hidden; + text-overflow: ellipsis; +} + +.text-ellipsis-multiline() { + overflow: hidden; + text-overflow: ellipsis; +}