css - 移动浏览器不允许滚动

标签 css mobile

我刚刚用我的 Android 手机测试了我的新网站,我无法在页面上的任何地方滚动。在 Firefox、opera、ie 和 chrome 桌面浏览器上,我会在需要时获得垂直滚动。在我的 html 中,body css 规则我有 overflow-y 滚动;宽度不应滚动。我可能在这里遗漏了一些简单的东西,但我从来没有在我做过的任何其他网站上遇到过这个。

这是我的站点 CSS:

@charset "utf-8";
/* CSS Document */
#body{


    min-width: 900px;
    width: 75%;
    background-size: cover;
    background-image: url(../graphics/back2.jpg);   
    position: relative;
    margin: 40px auto;
    padding: 10px;
    border-style: groove;
    border-width: 5px;
    border-color: #000; 
    background-repeat: repeat-y;    
}
a:link, a:visited, a:active{
    text-decoration: none;
    color: inherit;

}
a:hover{
    color: #FFF;
    text-decoration: underline; 
}
html, body{
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    overflow-y: scroll; 
    background-image: url(../graphics/craig-smith-background.jpg);
    line-height: 25px;
}

h1{
    font-size: 36px;
    font-family: "Times New Roman", Times, serif;
    color: #000;
    margin: 10px;
}
 h2{
    font-size: 30px;
    font-family:"Times New Roman", Times, serif;
    margin-left: 30px;
    color: #333;
    font-weight: 700;
    margin: 20px;
}
h3{
    font-size: 24px;    
    margin: 10px;
}

p{
    font-size: 20px;
    font-family: "Times New Roman", Times, serif;
    color: #FFF;
    text-indent: 1.5em;
    margin-left: 1.5em;
}
#quote{
    margin-left: 30px;
    font-style: italic;
    font-family: lucida;
    font-size: 18px;
    border-style: inset;
    border-color: #333;
    border-width: 2px;
    height: 80px;
}

#header{
    width: auto;
    margin: 0 auto;
    position: relative;
    text-align: center;

}

#nav{
    position: absolute;
    z-index: 1;
    left: 25%;

    top: 150px;
    }
.picture{
    display: inline-block;
    position: relative;
    margin: 0 auto;
    border-style: groove;
    border-width: 5px;
    border-color: #999; 
}

.clear-left{
    clear: left;
    position: relative;

}

.clear-right{
    clear: right;
    position: relative;
}

.clear-all{
    clear: both;
    position: relative;
}

#left-col{
    width: 25%;
    min-width: 300px;
    position: relative; 
    float: left;
    text-wrap: normal;
    overflow: hidden;
    margin-bottom: 10px;
    margin-top: 10px;
    text-align: right;
}

#right-col{
    min-height: 500px;
    min-width: 500px;
    width: 65%;
    text-align: left;
    float: right;
    border-style: groove;
    border-width: 5px;
    border-color: #CCC;
    margin-bottom: 10px;
    margin-top: 10px;
    text-wrap: normal;
    text-indent: 10px;

}
#footer{
    width: 85%;
    height: 40px;
    background-color: #999;
    text-align: center;
    margin: 10px auto;
    padding: 0px;
    padding-bottom: 10px;
    border-style: groove;
    border-width: 2px;
    border-color: #999;
}

#project-description h1{
        text-align: center;
        font-size: 36px;
}

.project-description h2{
    color: #333;
    font-weight: bold;  
}





.project-description{
    border-style: inset;
    border-width: 3px;
    border-color: #333;
    margin: 10px;
    padding: 5px;

}

.project-description p{
    margin-left: 70px;  
    text-indent: 0;
}
table{
    border-spacing: 0;
    border-collapse: collapse;


}
td, th, tr{
    padding: 0; 
    line-height: 20px;
}

here's实时站点链接。

最佳答案

您不需要为 body 和 html 标签提供 overflow-y: scroll; 样式。这导致双滚动条在移动浏览器中失败。您甚至不需要指定它,因为它是默认行为。您可能只想在 body 标签上设置 overflow-y: scroll;overflow-x: hidden;

关于css - 移动浏览器不允许滚动,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15213983/

相关文章:

html - 无法识别控制背景颜色的 CSS 或元素

flash - AIR renderMode GPU与renderMode Direct

css - 如何使居中固定宽度的主体响应?

iphone - 如何检测移动网站的触摸屏手机

html - 学习如何构建混合 HTML5 应用程序的起点?

Javascript keydown 函数不能同时注册两个键

rgba 的 CSS 背景不透明度在 IE 8 中不起作用

html - 使用 Z-index,边距无法将 div 推离另一个

javascript - 我想关闭在触摸(单击)切换按钮时出现的下拉菜单。(移动 View )

css - m.subdomain - 我的理解正确吗?