php - 为什么我没有滚动条?

标签 php html css

我正在用 HTML、CSS 和 PHP 制作一个网站,页面超出了屏幕,但浏览器没有提供滚动条(Mac 上的 Safari 5.0.6 和 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;
}

最佳答案

您的所有内容都包含在 position: fixed; 元素中。正文无法检索固定或绝对子项的高度,因此设置为实际高度 0 - 从而消除了滚动的任何需要。

如果您将 #content 元素移到固定 header 之外,事情应该会按预期工作。

关于php - 为什么我没有滚动条?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14029102/

相关文章:

css - .hover 和 :hover? 有什么区别

php - 检索 cookie 不起作用(具有自定义域的本地主机)

php - 是否可以从 MySQL 数据库加载坐标并在 Android 谷歌地图中显示为标记

javascript - 如果 url 的一部分与菜单项匹配,则将类添加到导航

javascript - 如何创建包含 php + Javascript 变量的 href 链接

html - 在任何元素上居中叠加微调器

html - CSS 下拉菜单不适用于位置 :relative?

php - 如何在不加入 doctrine2 的情况下获得 id?

php - Flowgear 可配置变量栏,用于通过 API 进行 sql 查询

html - Angular - 如何显示基于下拉选项的输入