1、显示效果
2、代码展示
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
<style>
.divMaxShow:hover {
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
text-decoration: underline;
cursor: pointer;
color: red;
}
.divMaxShow {
overflow: hidden; /*超过容器长度的截取*/
text-overflow: ellipsis; /*超过容器长度的截取后用省略号代替*/
white-space: nowrap; /*容器内的文本不换行*/
display: block;
150px;
text-align: center;
margin: 5px 20px;
font-weight: bold;
border: 1px solid red;
}
</style>
</head>
<body>
<div class="divMaxShow" title="这里是全部的信息没有省略号,理超长文本全部显示">这里是全部的信息,理超长文本显示省略号</div>
</body>
</html>