<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<style>
* {
padding: 0;
margin: 0;
}
.allBox {
30%;
display: flex;
flex-wrap: wrap; /*只需要写这行样式就可以实现div自动换行了*/
}
.allBox .con {
10%;
height: 20px;
background-color: green;
height: 110px;
margin: 20px;
overflow:hidden;/*文字超出省略号显示*/
text-overflow:ellipsis;
white-space:nowrap;
}
</style>
</head>
<body>
<div class="allBox">
<div class="con">这是个寂寞的天,下着有些伤心的雨</div>
<div class="con">这是个寂寞的天,下着有些伤心的雨</div>
<div class="con">这是个寂寞的天,下着有些伤心的雨</div>
<div class="con">这是个寂寞的天,下着有些伤心的雨</div>
<div class="con">这是个寂寞的天,下着有些伤心的雨</div>
<div class="con">这是个寂寞的天,下着有些伤心的雨</div>
<div class="con">这是个寂寞的天,下着有些伤心的雨</div>
<div class="con">这是个寂寞的天,下着有些伤心的雨</div>
<div class="con">这是个寂寞的天,下着有些伤心的雨</div>
<div class="con">这是个寂寞的天,下着有些伤心的雨</div>
<div class="con">这是个寂寞的天,下着有些伤心的雨</div>
<div class="con">这是个寂寞的天,下着有些伤心的雨</div>
<div class="con">这是个寂寞的天,下着有些伤心的雨</div>
</div>
</body>
</html>