duanbi6522 2017-05-29 06:44
浏览 447
已采纳

垂直滚动条不起作用

Here is my problem i want to use scrollbar but it is only showing scrollbar but that scrollbar is not working. I am using CSS to style the scrollbar and other layouts and Html to use that styling. here is my Styling Code

  #sub_menu, #content{
    display: inline-block;
}

#sub_menu{
    width:23%;
    height: 10%;
    background-color: #999999;
    padding: 1%;
    vertical-align: top;
    border: 1px solid;
}
#content{
    width: 73%;
    margin-right: 1%;
}
@media screen and (max-width: 600px), sreen\0{
 #sub_menu{
        height: initial;
        font-size: 15px;
        margin-bottom: 2%;
    }
    #content, #sub_menu{
        display: block;
        width: 95%
    } }
 .contentt {



  height: 100%;
  overflow-y: scroll;
  margin-bottom: 1%;
}

.contentt::-webkit-scrollbar { 

  display: none;
}

And Here is my HTML CODE

 <div id="sub_menu">
                      <h3  style="border-bottom: 3px solid rgb(135, 31, 139);">Related Videos</h3>


    <div class="contentt" style="width:100%;height:40%; margin-bottom:3%;padding:2%" >

     <?php

    $con = new mysqli('localhost','','','');


    $sql = "SELECT ID, Title, Link FROM that where Category like 'this'";
    $result = $con->query($sql);

    if ($result->num_rows > 0) {

    while($row = $result->fetch_assoc()) {

        $url = $row["Link"];


        $title = $row["Title"];
        $id = $row["ID"];
        $path="http://domain/Song.php";

        echo "<h5>$title'</h5>";
        echo '<a href="' . $path . '?Title=' . $title .'&id=' . $id .'"><img src="http://domain/images/' . $id .'.jpg"  alt="HTML tutorial" style="width:75%;height:95%;border:0;"class="btnn songpicc"></a>';

       echo '<hr>';
    }
    } else {
    echo "0 results";
    }

    $con->close();

    ?>
    </div>
    </div>

Thanks in Advance

  • 写回答

3条回答 默认 最新

  • douji8549 2017-05-29 06:57
    关注

    You need to fix the height of the container (not in %, but in px or em for example) with overflow-y: scroll;

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(2条)

报告相同问题?

悬赏问题

  • ¥40 复杂的限制性的商函数处理
  • ¥15 程序不包含适用于入口点的静态Main方法
  • ¥15 素材场景中光线烘焙后灯光失效
  • ¥15 请教一下各位,为什么我这个没有实现模拟点击
  • ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来
  • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码