1. .lineOne{
    2. text-overflow:ellipsis;
    3. -o-text-overflow:ellipsis;
    4. overflow: hidden;
    5. display: -webkit-box;
    6. -webkit-box-orient: vertical;
    7. -webkit-line-clamp: 6; //显示几行
    8. }
    9. .div-td-content-more {
    10. position: absolute;
    11. height: auto;
    12. z-index: 999;
    13. line-height: 20px;
    14. background-color: #d3e8fd;
    15. padding: 8px 6px;
    16. border: 1px solid #e8e8ea;
    17. display: none;
    18. }

    CSS
    点击显示隐藏内容

    1. <script>
    2. $(function () {
    3. $("body").on("click", ".lineOne", function (e) {
    4. if ($(".div-td-content-more").is(":hidden")) {
    5. var text = $(this).text();
    6. if (text != "") {
    7. text = "<i></i>" + text;
    8. $(".div-td-content-more").html(text).css({
    9. "width": $(this).outerWidth() + "px",
    10. "left": $(this).offset().left,
    11. "top": ($(this).offset().top + $(this).outerHeight()) + "px"
    12. }).show();
    13. e.stopPropagation();
    14. }
    15. } else {
    16. $(".div-td-content-more").hide();
    17. }
    18. });
    19. $("body").on("click", ".div-td-content-more", function (e) {
    20. e.stopPropagation();
    21. });
    22. $("body").on("click", function () {
    23. $(".div-td-content-more").hide();
    24. });
    25. });
    26. </script>

    页面

    1. <td style="vertical-align: top;overflow: hidden;"> <span class="lineOne">{{list.text}}</span></td>