Skip to content

Instantly share code, notes, and snippets.

@omega-takai
Last active February 10, 2020 03:49
Show Gist options
  • Save omega-takai/d70b526aa8bf0d258fad933d818c7762 to your computer and use it in GitHub Desktop.
Save omega-takai/d70b526aa8bf0d258fad933d818c7762 to your computer and use it in GitHub Desktop.
複数行対応の3点リーダー省略スタイル
@mixin truncateStyle($showLine: 3, $bgColor: #EEE, $fontSize: 14px, $lineHeight: 1.4)
background: $bgColor
overflow: hidden
font-size: $fontSize
max-height: $fontSize * $lineHeight * $showLine
line-height: $lineHeight
position: relative
&:before,
&:after
background: $bgColor
position: absolute
&:before
content: '...'
top: $fontSize * $lineHeight * ($showLine - 1)
right: 0
width: 1em
&:after
content: ''
height: 100%
width: 100%
// Example
.truncateStyle
@include truncateStyle
width: calc(100% - 6rem)
margin: 2rem auto
@omega-takai
Copy link
Author

dart-sass... 😭

    height: $fontSize * $lineHeight * $showLine
           ^
      Undefined operation: "1.6rem times 1.2".

@omega-takai
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment