如何使滚动条小于其div父级?

问题描述

我想在div元素的另一个div元素的y轴上创建滚动条。子div大于其父div und,因此滚动条在那里但无法选择。谁能帮我吗?

<style>
.sidebar {
    position: fixed;
    bottom: -500px;
    right: 1000px;
    width: 350px;
    height: 500px;
    background: white;
    border-top: 3px solid black;
    border-left: 3px solid black;
    z-index: 60;
    overflow: auto;
}
.sidebar .scroll {
    background-color: white;
    display: block;
    width: 1000px;
    overflow-x: scroll;
    overflow-y: hidden;
}
</style>

<div style="text-align: center" class="sidebar">
    <label for="check">
        <div style="cursor: pointer; height: 40px; width: 100%; background-color:lightgrey; font-family:Arial,Helvetica,sans-serif; font-size: 20px; border-bottom: 3px solid black; top:0; font-weight: bold;">
            <i id="cancel"></i>
            <hr style="height:8px; visibility: hidden; margin-bottom:-1px"> Chat schließen</div>
    </label>
    <div class="scroll" style="top:40; height: 80px; border-bottom: 3px solid black;">
        <?PHP
        $verbindung = MysqLi_connect("localhost","root","Helsinki2?");
        MysqLi_select_db($verbindung,"authentication");
        $result = MysqLi_query($verbindung,"select * from users");
        while ($row = MysqLi_fetch_array($result)) {
        ?>
            <img style="position: relative; left: 6px; top: 15px; height: 40px; width: 40px;" src="img/user.png">
        <?PHP
            echo "" . $row['username'] . " ";
        }
        ?>
    </div>

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)