overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
複数行用
p {
display: -webkit-box;
-webkit-box-orient: vertical;
-webkit-line-clamp: 3;
overflow: hidden;
}
↑のでよさそう
複数行用mixin
@mixin textOverflow($font-size, $line-height, $lines) {
font-size: $font-size;
height: $font-size * $line-height * $lines;
line-height: $line-height;
position: relative;
overflow: hidden;
&:before,
&:after {
background: #fff;
position: absolute;
}
&:before {
content: "...";
top: $font-size * $line-height * ($lines - 1);
right: 0;
padding-left: 5px;
}
&:after {
content: "";
height: 100%;
width: 100%;
}
}
※要position: relative;&背景べた塗