overflow 顯示一行可以滑動,不顯示滑動滾動條

使用兩個div,完成div將內層div的滾動條遮擋住,使用戶看不到滾動條
<html>
<head>
<style type="text/css">
body,p{
  margin:0;
}
.citySpan{
display: inline-block;
    text-align: left;
    padding-left:10px;
}
.div1{
  font-size: 10px;
    color: #a4a4a4;
    padding-left: 2%;
    width: 100%; 
    white-space: nowrap;
    text-overflow: ellipsis; 
    overflow: hidden; 
    height: 30px;
}
</style>
</head>

<body>
<div class="div1">
  <div style="overflow-x: auto; height: 50px;">
    <p>
      <span class="citySpan">安陽東--阿拉山口</span>
      <span class="citySpan">石家莊--阿拉山口</span>
      <span class="citySpan">武漢--天津</span>
      <span class="citySpan">合肥--廣州</span>
      <span class="citySpan">上海--合肥</span>
    </p>
  </div>
</div>
</body>

</html>

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章