美文网首页
元素溢出隐藏滚动

元素溢出隐藏滚动

作者: visitor009 | 来源:发表于2018-11-13 10:43 被阅读0次
  1. flex + overflow
//css
        .class-column {
            display: flex;
            overflow-x: scroll;
        }
        .class-column a {
            flex: none;
            width: 50vw;
            height: 300px;
            background: #ccc;
            margin-right: 10px;
        }
//html
    <nav class="class-column">
        <a href=""></a>
        <a href=""></a>
        <a href=""></a>
        <a href=""></a>
    </nav>
  1. white-space + inline-block
// css
        .class-column {
            overflow-x: scroll;
            white-space: nowrap;
        }
        .class-column a {
            display: inline-block;
            width: 50vw;
            height: 300px;
            background: #ccc;
            margin-right: 10px;
        }
// html
    <nav class="class-column">
        <a href=""></a>
        <a href=""></a>
        <a href=""></a>
        <a href=""></a>
    </nav>
    

相关文章

网友评论

      本文标题:元素溢出隐藏滚动

      本文链接:https://www.haomeiwen.com/subject/brykfqtx.html