首页 新闻 赞助 找找看

如何实现[父容器溢出滚动,子div横向排列]?

0
[已解决问题] 解决于 2017-11-02 13:16
<!DOCTYPE html>
<html>

    <head>
        <meta charset="UTF-8">
        <style type="text/css">
            div{
                border: 1px solid black;
            }
            .ctn{
                width: 300px;
                height: 300px;
                
            }
            .div1{
                width: 200px;
                height: 200px;
            }
            .div2{
                width: 200px;
                height: 200px;
            }
            .div3{
                width: 200px;
                height: 200px;
            }
        </style>
    </head>

    <body>
        <div class="ctn">
            <div class="div1">div1</div>
            <div class="div2">div2</div>
            <div class="div3">div3</div>
        </div>
    </body>

</html>

renguanyu的主页 renguanyu | 小虾三级 | 园豆:836
提问于:2017-11-02 11:42
< >
分享
最佳答案
1

.ctn {overflow-x: scroll; white-space: nowrap; width: 100%;}

.div1, .div2, .div3 {display: inline-block;}

奖励园豆:5
by.Genesis | 老鸟四级 |园豆:2719 | 2017-11-02 11:48
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册