文字一行显示,多出部分显示成省略号
- html结构
<div class="title">前端开发工程师</div>
- 对应的css样式为
.title{
width: 50px;
color: skyblue;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
- 最终展示在页面的效果如下:
<div class="title">前端开发工程师</div>
.title{
width: 50px;
color: skyblue;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}