2017-05-29 104 views
0

這裏是我的問題,我想使用滾動條,但它只是顯示滾動但滾動條不工作。我使用的CSS樣式的滾動條等的佈局和HTML使用該造型。 這裏是我的樣式代碼垂直滾動條不工作

#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; 
} 

,這裏是我的HTML代碼

<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> 

由於提前

回答

1

你需要修復的高度容器(不在%中,但在px或em中)使用overflow-y:scroll;

1

你的滾動條不工作,或者是隱藏?

刪除下面的CSS,它應該爲你工作

.contentt::-webkit-scrollbar { 
    display: none; 
} 

,而是

.contentt { 
    overflow-y: scroll; 
} 

只是採用下面的代碼,並檢查

.contentt { 
    height: 400px; 
    overflow-y: auto; 
} 
+0

它是隱藏的,也沒有工作。但是當我刪除了此代碼的滾動條顯示,但不會再工作 – bebo

+0

你有什麼實際網址我可以檢查真正的問題 – Rahul

+0

@bebo檢查我的更新ANS,並嘗試一次 – Rahul

1

只是刪除下面的代碼CSS

.contentt::-webkit-scrollbar { 
    display: none; 
} 

的下方添加CSS

.contentt { 
     overflow-y:auto; 
     height:/* give here height in px as you need */ 
    } 

的代碼,如果你使用webkit-scrollbar它會隱藏在Chrome的滾動條。但Firefox仍然保持默認的滾動條。

+0

現在的滾動條顯示,但其不工作 – bebo