<style> div{ width: 100px; height:30px; background: greenyellow; margin: 20px; color: red; } .b{ overflow: hidden; // 多余的内容隐藏 text-overflow: ellipsis; //多余的文本变成。。。 white-space: nowrap; //文本不换行 } </style>
<body>
<div class="b">123123123123123123</div>
<div>123123123123123123</div>
</body>