-webkit-line-clamp
今のところ Webkit のみの機能のように見える を扱うときに、この質問に行き着きます。
したがって、このために作成するscss mixinは
@mixin line-clamp($line) {
height: calc(1.3em * #{$line});
&:after {
content: '...';
}
@media screen and (-webkit-min-device-pixel-ratio:0) {
display: -webkit-box;
overflow: hidden;
-webkit-box-orient: vertical;
-webkit-line-clamp: $line;
}
@media screen and (min--moz-device-pixel-ratio:0) {
display: block;
text-overflow: ellipsis;
overflow: hidden;
position: relative;
padding-right: 10px;
&:after {
position: absolute;
bottom: 0;
right: 0;
}
}
}
異なるメディア クエリを使用して、webkit と Firefox の scss を分離します。