2012-12-25 74 views
8

我在HTML,CSS和PHP中製作網站,頁面超出屏幕,但沒有瀏覽器提供的滾動條(Mac 5.0.0和Firefox 14.0.1)。是否因爲我包含了PHP?但是在頁面呈現之前不應該存在嗎?爲什麼我沒有滾動條?

這裏是一個鏈接:test website

我的PHP語法:

<div id="content"> 
     <div class="wrapper"> 
      <div id="home" class="alert"> 
       Welcome to always4free&copy;! To browse the classifieds, you must first either choose a location or have your location detected. 
      </div> 
      <?php include "res/pages/categories.php"; ?> 
     </div> 
    </div> 
</div> 

這是怎麼回事?

編輯:這裏是我的CSS:

body { 
    background-image: url("http://always4free.org/site/images/bg.jpg"); 
    background-size: cover; 
    font-family: "Mouse Memoirs",sans-serif; 
} 
.wrapper { 
    margin: 0 auto; 
    width: 850px; 
} 
#header { 
    background: none repeat scroll 0 0 rgba(0, 0, 0, 0.5); 
    border-bottom: 3px solid green; 
    box-shadow: 0 2px 10px #888888; 
    height: 50px; 
    left: 0; 
    position: fixed; 
    top: 0; 
    width: 100%; 
} 
#logo { 
    color: rgba(255, 255, 255, 0.7); 
    float: left; 
    font-family: "Wendy One",sans-serif; 
    font-size: 30px; 
    line-height: 50px; 
    width: 250px; 
} 
#logo a:hover { 
    color: #FFFFFF; 
} 
#nav { 
    float: right; 
    line-height: 50px; 
    width: 600px; 
} 
#nav a:first-child { 
    margin-left: 0; 
} 
#nav a:last-child { 
    margin-right: 0; 
} 
#nav a:link, #nav a:visited { 
    color: rgba(255, 255, 255, 0.9); 
    font-family: "Mouse Memoirs",sans-serif; 
    letter-spacing: 1px; 
    margin-left: 10px; 
    margin-right: 10px; 
} 
#nav a:hover { 
    border-bottom: 2px solid #FFFFFF; 
    color: #FFFFFF; 
    padding-bottom: 1px; 
} 
#nav a.detect { 
    background-color: rgba(255, 255, 255, 0.7); 
    border: 1px solid rgba(255, 255, 255, 0.4); 
    border-radius: 2px 2px 2px 2px; 
    color: rgba(0, 0, 0, 0.7); 
    padding: 5px; 
} 
#nav a.detect:hover { 
    color: #000000; 
} 
#content { 
    font-family: "Mouse Memoirs",sans-serif; 
    letter-spacing: 1px; 
    margin-top: 70px; 
} 
.page { 
    background: none repeat scroll 0 0 rgba(0, 0, 0, 0.5); 
    border: 1px solid green; 
    color: #FFFFFF; 
    font-size: 20px; 
    padding: 10px; 
} 
.alert { 
    background: none repeat scroll 0 0 #AD2E1D; 
    border: 1px solid #911E0F; 
    color: white; 
    font-size: 20px; 
    padding: 10px; 
    text-align: center; 
} 
#categories { 
    margin-top: 20px; 
} 
#categories h2 { 
    color: rgba(255, 255, 255, 0.7); 
    font-family: "Wendy One",sans-serif; 
    font-size: 26px; 
} 
#categories a:link, #categories a:visited { 
    background: none repeat scroll 0 0 white; 
    color: black; 
    padding: 3px; 
} 
#categories .block { 
    line-height: 35px; 
} 
+0

檢查你有'溢出:滾動;'CSS屬性或不 – Rahul

+0

我補充說,沒有發生任何事。白條出現在那裏,但沒有滾動條。 – gtr123

回答

0

移動你的div id爲content以外的header股利。

它會解決你的問題。

+0

我不敢相信我沒注意到!謝謝! – gtr123

0

添加clearfix類與.wrapper,使其具有高度,然後使用:

.wrapper{ 
    overflow: scroll; 
} 
+0

白條出現在那裏,但沒有滾動條。雖然我不知道爲什麼! – gtr123

+0

我編輯了我的答案,請使用.clearfix然後重試。 – prium

3

您已將所有內容包裝在position: fixed;的元素內。身體無法檢索固定或絕對兒童的身高,因此設置爲0的實際高度 - 從而消除了滾動的任何需要。

如果您將#content元素移動到固定標題外,應該按預期工作。

0

add overflow:scroll;在您的#header風格和更改位置到相對

#header { 
    background: none repeat scroll 0 0 rgba(0, 0, 0, 0.5); 
    border-bottom: 3px solid green; 
    box-shadow: 0 2px 10px #888888; 
    height: 50px; 
    left: 0; 
    position: **relative**; 
    top: 0; 
    width: 100%; 
    **overflow: scroll;** 
} 
相關問題