zoukankan      html  css  js  c++  java
  • 横向滚动div

    <div id="shelf">

      <div class="books"><div>

      <div class="books"><div>

      //... more books

    </div>

    #shelf{
    margin-top: 50px;
    display: -webkit-box;
    overflow-x: scroll;
    -webkit-overflow-scrolling:touch;
    }
    .books{
    200px;
    height: 200px;
    border:5px solid #ccc;
    margin-right: 30px;
    }

    滚动的时候会出现横向滚动条,不美观,这时候可以在#shelf的外层加一个div,设置其高度小于等于#shelf.height-scroll.height,即可。

    比如:

     1 #shelf_wrap{
     2     margin-top:0.5rem;
     3             height:9rem;
     4             overflow-x:hidden;
     5             overflow-y:hidden;
     6     #shelf{
     7             display: -webkit-box;
     8             overflow-x: scroll;
     9             -webkit-overflow-scrolling:touch;
    10             .books{
    11               width: 6rem;
    12                    height: 8.5rem;
    13                    border:1px solid #ccc;
    14                    margin-left: 0.5rem;
    15                    margin-bottom:1.5rem;
    16                    text-align:center;
    17             .img_c{
    18                     width: 5rem;
    19                     height: 7rem;
    20                     overflow:hidden;
    21                     margin: 0px auto;
    22                     margin-top:0.4rem;
    23                 img{
    24                     max-width:100%;
    25                     height:auto;
    26                 }
    27             }
    28                 span{
    29                     font-size:1rem;
    30                     font-style:italic;
    31                     vertical-align:bottom;
    32                 }
    33             }
    34     }
    35 
    36 }
  • 相关阅读:
    配置禅道遇到的那些事儿
    HDU 1181
    HDU1016
    HDU 1518
    2015长春区域赛赛后总结
    Codeforces Round #322 (Div. 2) A B C
    Codeforces Round #325 (Div. 2) A B
    Codeforces Round #324 (Div. 2) A B
    CSU 1530
    CSU 1535
  • 原文地址:https://www.cnblogs.com/alan2kat/p/7339348.html
Copyright © 2011-2022 走看看