Skip to content

Instantly share code, notes, and snippets.

@airen
Created April 15, 2015 08:48
Show Gist options
  • Save airen/599f5d4cbe6d8d108eda to your computer and use it in GitHub Desktop.
Save airen/599f5d4cbe6d8d108eda to your computer and use it in GitHub Desktop.
Generated by SassMeister.com.
<div class="wrap">
<div class="one">我的中国我的中国我的中国我的中国我的中国我的中国我的中国我的中国我的中国我的中国</div>
<div class="more">我的中国我的中国我的中国我的中国我的中国我的中国我的中国我的中国我的中国我的中国我的中国</div>
</div>
// ----
// Sass (v3.4.12)
// Compass (v1.0.3)
// ----
/// 控制文字行数溢出点点点
/// @param {[string]} $v [1] 默认一行对于点点点结束
/// @link http://gitlab.alibaba-inc.com/mtb/browser-designer/raw/dev/index.html?u=1256
@mixin boxClamp($v:1){
overflow:hidden;
-webkit-line-clamp: $v;
line-clamp: $v;
-webkit-box-orient: vertical;
box-orient: vertical;
display:-webkit-box;
display:box;
}
.wrap {
width: 300px;
border: 1px solid;
padding: 5px;
div {
margin: 5px;
}
}
.one {
@include boxClamp;
}
.more{
@include boxClamp(2);
}
.wrap {
width: 300px;
border: 1px solid;
padding: 5px;
}
.wrap div {
margin: 5px;
}
.one {
overflow: hidden;
-webkit-line-clamp: 1;
line-clamp: 1;
-webkit-box-orient: vertical;
box-orient: vertical;
display: -webkit-box;
display: box;
}
.more {
overflow: hidden;
-webkit-line-clamp: 2;
line-clamp: 2;
-webkit-box-orient: vertical;
box-orient: vertical;
display: -webkit-box;
display: box;
}
<div class="wrap">
<div class="one">我的中国我的中国我的中国我的中国我的中国我的中国我的中国我的中国我的中国我的中国</div>
<div class="more">我的中国我的中国我的中国我的中国我的中国我的中国我的中国我的中国我的中国我的中国我的中国</div>
</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment