给div添加横向的滚动条
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title></title>
<style type="text/css">
*{
margin: 0;
padding: 0;
}
.div1{
height: 100px;
width: 600px;
background: aqua;
}
ul,li{
list-style: none;
}
ul{
overflow: hidden;
overflow-x: auto;
white-space: nowrap;
}
li{
height:80px;
width: 212px;
background: salmon;
margin-right: 5px;
display: inline-block;
}
</style>
</head>
<body>
<div class="div1">
<ul>
<li>
li1
</li>
<li>
li2
</li>
<li>
li3
</li>
<li>
li4
</li>
<li>
li5
</li>
</ul>
</div>
</body>
</html>
li的display:inline-block;不可缺少;
ul的white-space:nowrap;不可缺少