css control exceeds width... show

css control exceeds width... show

1. When one line:

  div{
    
    
		overflow: hidden;
		text-overflow:ellipsis;
		white-space: nowrap
	}

2. When there are multiple lines:

 div{
    
    
	  overflow: hidden;
      text-overflow: ellipsis;
      display: -webkit-box;
      -webkit-line-clamp: 2;
      -webkit-box-orient: vertical;
}

As shown in the figure:
insert image description here
Of course, it is OK to use string interception, but css is relatively more convenient.

Guess you like

Origin blog.csdn.net/weixin_45103130/article/details/125160410