2012-09-25 33 views
2

所以我提出,使用下面的CSS代碼了幾頁:爲什麼我的頁面不可滾動?

html { overflow-y: scroll; } 
    ul.navbar { 
    list-style-type: none; 
    position: fixed; 
    top: 00px; 
    left: 00px; 
    width: 200px; 
    height: 700px; 

    background-image:url('/images/B_left-background.png'); 
} 

ul.header { 
    position: fixed; 
    top: -20px; 
    left: 240px; 
    height: 100px; 
    width:700px; 
    background-image:url('/images/B_left-top.png'); 
} 

body { 

    position: fixed; 
    top: 100px; 
    left: 300px; 

    font-family: Georgia, "Times New Roman", 
     Times, serif; 

    background-color: #D6E9B4; 
} 
div.scrollableContainer { 
    background: none repeat scroll 0 0 ; 
    border: 1px solid #999999; 
    height: 400px; 
    margin: 40px; 
    overflow: auto; 
    width: 800px; 
} 
h1 {font-family: Helvetica, Geneva, Arial, 
     SunSans-Regular, sans-serif } 
ul.navbar a {text-decoration: none } 

a.send{ 
    color: black; 
    background-image:url('/images/send-message-bt.png'); 
    position:fixed; 
    top:200px; 
    left:0px; 
    height:80px; 
    width:290px; 
} 

a.token{ 
    color: black; 
    background-image:url('/images/token-ID-bt.png'); 
    position:fixed; 
    top:300px; 
    left:0px; 
    height:80px; 
    width:290px; 
} 

a.history{ 
    color: black; 
    background-image:url('/images/history-bt.png'); 
    position:fixed; 
    top:400px; 
    left:0px; 
    height:80px; 
    width:290px; 
} 

a.comp{ 
    background-image:url('/images/competition-bt.png'); 
    position:fixed; 
    top:500px; 
    left:0px; 
    height:80px; 
    width:290px; 
} 

a.out{ 
    background-image:url('/images/B_log-out-bt.png'); 
    position:fixed; 
    top:600px; 
    left:50px; 
    height:60px; 
    width:160px; 
} 

我想使整個頁面滾動,所以如果有人低分辨率設備上仍然可以向下滾動。你可以看到我在: html {overflow-y:scroll; } 但這沒有幫助。

有沒有什麼辦法可以解決這個問題?這與我設置固定高度有什麼關係嗎?

+1

它的所有固定定位是造成這個問題! ,該網頁不知道它有多長,因此,爲什麼你從來沒有得到一個滾動條,嘗試將其更改爲相對或絕對,看看是否有什麼差別 – Reina

+0

@Reina:絕對沒有比固定在這種情況下更好,因爲兩者取文件正常流出的元素。 – daGUY

+0

感謝雷納,我想你可能是對的。任何想法我怎麼能做到這一點? – HansStam

回答

0

那麼事實證明我做了我的側欄不可滾動,並把它放在一個固定的位置。 這是一個壞主意,所以我把它設置爲絕對位置。 @Reina你的想法(由固定改爲abolute幫助我到達那裏感謝

+1

沒問題漢斯:) – Reina

6

試試這個:

html { overflow-y: scroll; } 
body { position: absolute; } 

或者這樣:

html { overflow-y: scroll; overflow-x:hidden; } 
body { position: absolute; } 
+0

感謝蒂莫,但那沒有奏效。 :( – HansStam

0

溢出-Y:滾動; 到身體和HTML

html,body{overflow-y: scroll; } 
相關問題