CSS: Can you prevent overflow: hidden from cutting-off the last line of text?

前端 未结 8 2116
余生分开走
余生分开走 2020-12-13 10:00

When using CSS overflow: hidden , I\'ve often found that the last line of text gets partially cut-off. Is there a way to prevent this so that any partial lines do not show

8条回答
  •  北海茫月
    2020-12-13 10:28

    Rob is correct. I was making a div that had a max-height of 11em and the last line of overflow text was only half there. white-space: nowrap just eliminates that last line all together.

    I tried

    white-space: nowrap;
    

    and Gaby is also correct that this causes problems too.

    The best I came up with was to fiddle with the line-height and div height until the fewest lines were cut-off

提交回复
热议问题