码迷,mamicode.com
首页 > 其他好文 > 详细

给div添加横向的滚动条

时间:2017-04-02 17:50:24      阅读:153      评论:0      收藏:0      [点我收藏+]

标签:滚动   doctype   padding   lis   ack   add   char   isp   css   

<!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;不可缺少

 

给div添加横向的滚动条

标签:滚动   doctype   padding   lis   ack   add   char   isp   css   

原文地址:http://www.cnblogs.com/impossible1994727/p/6659294.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!