-1
A
回答
1
您可以用這種方法使用一種解決方案。
就是這樣。
/* styles for '...' */
.block-with-text {
/* hide text if it more than N lines */
overflow: hidden;
/* for set '...' in absolute position */
position: relative;
/* use this value to count block height */
line-height: 1.2em;
/* max-height = line-height (1.2) * lines max number (3) */
max-height: 3.6em;
/* fix problem when last visible word doesn't adjoin right side */
text-align: justify;
/* place for '...' */
margin-right: -1em;
padding-right: 1em;
}
/* create the ... */
.block-with-text:before {
/* points in the end */
content: '...';
/* absolute position */
position: absolute;
/* set position to right bottom corner of block */
right: 0;
bottom: 0;
}
/* hide ... if we have text, which is less than or equal to max lines */
.block-with-text:after {
/* points in the end */
content: '';
/* absolute position */
position: absolute;
/* set position to right bottom corner of text */
right: 0;
/* set width and height */
width: 1em;
height: 1em;
margin-top: 0.2em;
/* bg color = bg color under block */
background: white;
}
Ref。鏈接 - http://hackingui.com/front-end/a-pure-css-solution-for-multiline-text-truncation/
0
您可以使用Trunk8插件(jQuery)來實現此效果。它具有瀏覽器兼容性並且也具有響應能力。
相關問題
- 1. CSS多行省略號跨瀏覽器
- 2. 跨瀏覽器兼容
- 3. 跨瀏覽器兼容性
- 4. 是document.referrer跨瀏覽器兼容嗎?
- 5. 第二行的css省略號
- 6. 第二行的文本省略號
- 7. 如何使多行省略號工作IE瀏覽器
- 8. 文本省略號在第一跨度
- 9. 如何安全/可靠/跨瀏覽器兼容是$(this)[0] .defaultValue
- 10. jQuery.data()和跨瀏覽器的兼容性?
- 11. Opentype功能跨瀏覽器兼容性
- 12. Dash JS Player跨瀏覽器兼容性
- 13. 跨瀏覽器兼容回車
- 14. 小跨瀏覽器兼容CSS問題
- 15. 跨瀏覽器不兼容? (jQuery)
- 16. dojo跨瀏覽器兼容性
- 17. setAttribute,onClick和跨瀏覽器兼容性
- 18. 跨瀏覽器兼容滾動表
- 19. CSS字體跨瀏覽器兼容性
- 20. css調試,跨瀏覽器兼容性
- 21. IE跨瀏覽器兼容性問題
- 22. 跨瀏覽器兼容性測試
- 23. 瞭解跨瀏覽器兼容性
- 24. 跨瀏覽器兼容性問題
- 25. z-index跨瀏覽器不兼容性
- 26. CSS兼容性跨瀏覽器
- 27. ajax跨瀏覽器代碼兼容性
- 28. 跨瀏覽器兼容網頁
- 29. 如何獲得跨瀏覽器了兼容性對HTML5的window.fileReader API
- 30. 是否兼容瀏覽器