一行文字超出部分隐藏:
width: 200px; // 设定宽度
white-space: nowrap;// 文字不换行
overflow: hidden;// 超出隐藏
text-overflow: ellipsis;
实现移入后正常显示的可以加:hover
overflow: visible;
text-overflow: clip;
举例:
<div class="text">你真的很好你真的很好你真的很好你真的很好</div>
.text{
width: 200px;
background: #eee;
height: auto;
padding: 10px;
box-sizing: border-box;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.text:hover{
overflow: visible;
text-overflow: clip;
}
操作效果: