Only display a few lines of text beyond the hidden part and display the ellipsis


<view class="talkingContent">
    作息规律,能合理安排每日的学习与休闲活动时间,不过度使用电子产品发发发佛靠国际控股刚看过开始公开理工科节省空间福克斯积分卡积分卡积分卡交罚款JFK放假啊放假啊开发静安分局啊发发发发发发发发发大
</view>






.talkingContent{
                    display: -webkit-box;/*弹性伸缩盒子模型显示*/
                    -webkit-box-orient: vertical;   /*排列方式*/ 
                    -webkit-line-clamp: 3;/*显示文本行数*/
                    overflow: hidden;/*溢出隐藏*/
                    text-overflow:ellipsip;/*溢出显示省略号*/
                    margin-top: 24rpx;
                    width: 100%;
                    height: 116rpx;
                    line-height: 44rpx;
                }

Detailed explanation:

-webkit-line-clamp is used to limit the number of lines of text displayed in a block element. In order to achieve this effect, it needs to be combined with other webkit attributes.

Common binding properties:

display: -webkit-box The property that must be combined to display the object as a flexible box model

-webkit-box-orient: vertical; The property that must be combined to set or retrieve the arrangement of the child elements of the flex box object, here is the vertical arrangement.

text-overflow: ellipsip; can be used in the case of multi-line text, use the ellipsis "..." to hide the text beyond the range.

Guess you like

Origin blog.csdn.net/ll123456789_/article/details/131425896