您可以使用一些现代 css 技巧来做到这一点,请参阅jsfidle 示例
body{padding: 4em;}
h3{border:2px solid red;padding:.5em;}
h3 {
display: block; /* Fallback for non-webkit */
display: -webkit-box;
max-width: 400px;
height: calc(26px*1.4*4); /* Fallback for non-webkit */
margin: 0 auto;
font-size: 26px;
line-height: 1.4;
-webkit-line-clamp:4;
-webkit-box-orient: vertical;
overflow: hidden;
text-overflow: ellipsis;
}
<h3>Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Donec quam felis, ultricies nec, pellentesque eu, pretium quis, sem. Nulla consequat massa quis enim. Donec pede justo, fringilla vel, aliquet nec, vulputate eget, arcu. </h3>