快捷搜索:   MySQL PHP linux 播放器

css div 不换行,并改为平铺,可左右滑动

<!DOCTYPE html>
<html>
    <head>
        <meta charset="UTF-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <title>Document</title>
        <style>
            * {
                margin: 0;
                padding: 0;
            }
            .parent-list {
                width: 90%;
                height: 15rem;
                margin: 0 auto;
                text-align: center;
                margin-top: 2.25rem;
                white-space: nowrap;
                overflow-y: hidden;
            }
            .list {
                width: 10rem;
                height: 14.563rem;
                display: inline-block;
                transition: all 0.5s;
            }
        </style>
    </head>
    <body>
        <div>
            <div>1</div>
            <div>2</div>
            <div>3</div>
            <div>4</div>
            <div>5</div>
        </div>
    </body>
</html>

平铺的核心是使用 white-space: nowrap;


您可能还会对下面的文章感兴趣: