2012-12-25 77 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;** 
} 
相关问题