2015-09-06 73 views
0

早上好,如何在手机上滚动

我在手机上滚动我的网站时出现问题。我已将div高度设置为100%,但在移动设备上,它的高度为“自动”。但是,当文本长度超过屏幕高度时,我无法阅读它。我应该如何编辑它?谢谢!

HTML:

<div id="about"> 

<div id="onas"> 
<div id="obsah"> 
<p> text text text....</p> 
</div> 
</div> 
</div> 

CSS:

#about { 
background:url('images/bg-about.png') no-repeat center center fixed; 
    -webkit-background-size: cover; 
    -moz-background-size: cover; 
    -o-background-size: cover; 
    background-size: cover; 
    display: block; 

    min-height: 100%; 
    width: 100%; 
    color: white; 

    position: fixed; 
    top: 0; 
    left: 0; 
margin: 0 auto; 
z-index: 1; 
} 

#obsah { 
margin-left: 10%; 
margin-right: 10%; 
margin-top: 5%; 
color: black; 
font-size: 21px; 
} 

#onas { 
position: absolute; 
font-family: cond; 
bottom: 0; 
left: 0; 
width: 100%; 
background: rgba(255, 255, 255, .5); 
    min-height: 40%; 
} 

@media screen and (max-width: 1024px){ 

#onas { 
position: static; 
margin-top: 200px; 
padding-top: 15px; 
width: 100%; 
height: auto; 
min-height: 40%; 
} 

} 
+0

尝试添加到'#onas' overflow-x:hidden; overflow-y:auto;' – nelek

+0

它没有为我工作..:/ –

回答

1

你的问题是,你必须:

位置:固定;

在你的,你可能试图将它应用到背景。

删除该行,它将滚动。

docs

+0

我试过了,但我仍然无法在移动设备上滚动。问题不在我认为的高度,但必须在代码中的某处指定高度完全为100%,且不能超过此值。所以在手机屏幕上的文本是其长度的一半,我不能滚动完成阅读... –

+0

这是我的网页的URL:http://testovaci.mobydyk.cz/cernaruze/o-nas。 php –

+0

这是位置,谢谢! –