html - 为什么所有浏览器都没有滚动条?

标签 html css yii

我自己的页面没有滚动条,无论我做什么,最小化或放大/缩小。它只是没有出现,我试过 FF、Chrome 和 IE:都没有。其他网页没问题。这是 body 元素和 CSS:

<body>
<div class="container" id="page">

CSS 是这样的:

html, body
{
    margin: 0;
    padding: 0;
    color: #555;
    font: normal 10pt Arial,Helvetica,sans-serif;
    background: #EFEFEF;
    overflow: scroll;
}

#page
{
    margin-top: 5px;
    margin-bottom: 5px;
    background: white;
    border: 1px solid #C9E0ED;
}

PS:我用的是YII框架。

更新:

看来 YII 有一些默认的 css 设置,在 screen.css 中提到了 3 次 div container 如下:

 .container {width:1250px;margin:0 auto;}
 .container:after 
 {content:"\0020";display:block;height:0;clear:both;visibility:hidden;overflow:hidden;}

.container {display:block;}

我将 overflow:hidden 更改为 overflow:scroll 但仍然无效。

最佳答案

为了看到滚动,您必须定义创建滚动的高度和/或宽度。无法查看您是否有内容或您的标记是什么样的——在 HTML 或 body 标记处声明就可以了。

html, body
{
    margin: 0;
    padding: 0;
    color: #555;
    font: normal 10pt Arial,Helvetica,sans-serif;
    background: #EFEFEF;
    overflow: scroll;
    height: 1000px; // toggle
    width: 100% // toggle

}

关于html - 为什么所有浏览器都没有滚动条?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21108932/

相关文章:

javascript - 您如何确定加载和 DOMContentLoaded 事件的触发顺序?

javascript - 具有更多图像的 Jquery 1 id 并更改所有图像宽度/高度/位置

javascript - 如何将 Tabulator 表适合固定高度和宽度的 div?

javascript - jquery 动画无法正常工作

php - Yii1 : How to use concat function in mysq like query

PHP PDO Postgres 数据库启动/停止问题

html - 让顶部和底部边距留在 mat-grid-tile 内?

javascript - 修改查询字符串而不添加新的 HTTP 请求

html - 设置我的照片库的宽度

php - Yii 自定义路由在 nginx 中不起作用