-
-
Save ifyour/a62a7244eb22b7c7155430b471f44fc8 to your computer and use it in GitHub Desktop.
2行文字溢出显示省略, 支持 IE // Demo: http://js.jirengu.com/bozur
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<meta name="viewport" content="width=device-width"> | |
<title>JS Bin</title> | |
<style id="jsbin-css"> | |
.ellipsis-clamp { | |
line-height: 20px; | |
max-height: 40px; | |
text-overflow: ellipsis; | |
-webkit-text-overflow: ellipsis; | |
-moz-text-overflow: ellipsis; | |
box-orient: vartical; | |
-webkit-box-orient: vertical; /** 设置或检索伸缩盒对象的子元素的排列方式 **/ | |
line-clamp: 2; /** 显示的行数 **/ | |
-webkit-line-clamp: 2; /** 显示的行数 **/ | |
-moz-line-clamp: 2; /** 显示的行数 **/ | |
display: -webkit-box; | |
word-break: break-all; | |
overflow: hidden; /** 隐藏超出的内容 **/ | |
} | |
</style> | |
</head> | |
<body> | |
<p class="ellipsis-clamp"> | |
测试文字测试文字测试文字测试文字测试文字测试文字测试文字测试文字测试文字测试文字测试文字测试文字测试文字测试文字测试文字测试文字测试文字测试文字测试文字测试文字测试文字测试文字测试文字测试文字测试文字测试文字测试文字测试文字测试文字测试文字测试文字测试文字测试文字测试文字测试文字测试文字测试文字测试文字测试文字测试文字测试文字测试文字测试文字测试文字测试文字测试文字测试文字测试文字测试文字测试文字测试文字测试文字测试文字测试文字测试文字测试文字测试文字测试文字测试文字测试文字测试文字测试文字测试文字测试文字测试文字 | |
</p> | |
<script id="jsbin-source-css" type="text/css">.ellipsis-clamp { | |
line-height: 20px; | |
max-height: 40px; | |
text-overflow: ellipsis; | |
-webkit-text-overflow: ellipsis; | |
-moz-text-overflow: ellipsis; | |
box-orient: vartical; | |
-webkit-box-orient: vertical; /** 设置或检索伸缩盒对象的子元素的排列方式 **/ | |
line-clamp: 2; /** 显示的行数 **/ | |
-webkit-line-clamp: 2; /** 显示的行数 **/ | |
-moz-line-clamp: 2; /** 显示的行数 **/ | |
display: -webkit-box; | |
word-break: break-all; | |
overflow: hidden; /** 隐藏超出的内容 **/ | |
}</script> | |
</body> | |
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.ellipsis-clamp { | |
line-height: 20px; | |
max-height: 40px; | |
text-overflow: ellipsis; | |
-webkit-text-overflow: ellipsis; | |
-moz-text-overflow: ellipsis; | |
box-orient: vartical; | |
-webkit-box-orient: vertical; /** 设置或检索伸缩盒对象的子元素的排列方式 **/ | |
line-clamp: 2; /** 显示的行数 **/ | |
-webkit-line-clamp: 2; /** 显示的行数 **/ | |
-moz-line-clamp: 2; /** 显示的行数 **/ | |
display: -webkit-box; | |
word-break: break-all; | |
overflow: hidden; /** 隐藏超出的内容 **/ | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment