2017-09-26 12 views

답변

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)을 사용하면이 효과를 얻을 수 있습니다. 브라우저 호환성이 있으며 응답 성도 뛰어납니다.