【问题标题】:Gap below content on iPadiPad 上内容下方的间隙
【发布时间】:2013-09-30 08:59:01
【问题描述】:

我设置了一个网页,中间有一些链接,在该网页下方,一个 div 浮动在右侧,大约占屏幕的 25%,另一个 div 带有position: fixed, left: 0, bottom: 0。在我的桌面上,在 Firefox 中,固定位置 div 内的图像位于左下角。但是,在 iPad 上,浮动的右 div 下方有很大的空隙。图片要么从屏幕视图下方开始,要么从页面下方开始,在图片顶部和最后一个文本块的底部之间存在巨大的内容间隙。

HTML:

  <div class="wrapper">
     <div id="containerLeft">
        <img id="ipad" src="images/ipad-small.png" alt="a picture of an ipad held in a hand" />
     </div> 

     <div id="containerRight">
        <article>
           <p> stuff </p>
           <p> more stuff </p>
        </article>
     </div>
  </div>

CSS:

    .wrapper{
    width: 100%;
    overflow: hidden;
}
/* ------------ Left Container Content - image ------------- */
#containerLeft{
    width: 50%;
    z-index:-9999; 
    overflow: hidden;
    float: left;
}

#containerLeft img{
    position: fixed;
    left: 0;
    bottom: 0;
    display: block;
}

/* ---------- Right Container Content - copy on the side ---------------- */
#containerRight{
    width: 25%;
    float: right;
    margin: 50px 3.854167% 0 0;
}

#containerRight article{
    width: 100%;
}

#containerRight article p{
    line-height: 140%;
    font-weight: 400;
    font-size: 0.45em;
    text-align: right;
    font-style: italic;
    overflow: visible;
    padding: 1%;
    margin: 2% 0 0;
}

谁能从中看出是什么导致了屏幕底部的大间隙?

【问题讨论】:

  • 我测试了一些东西。我从正文中删除了所有内容,仍然可以在 iPad 上滚动。我让背景全黑,即没有图像。仍然可以滚动。就像 iPad 有一个最小高度,但任何时候我尝试在 html 标签中设置它(最大高度:760px)它什么都不做。
  • 嗨,Ethan,欢迎来到Stack Overflow。这仅发生在 iPad 或任何小屏幕设备(例如智能手机、上网本等)上吗?如果这不是 iOS/Safari 特定的问题,那么您需要解决一些问题。无论如何,如果您希望包含有关您的问题的信息,请继续编辑它 - 最好将其包含在您的问题中。谢谢!
  • 我在 Mac 上使用 iOS 模拟器,所以我只能在 Mobile Safari 上进行测试。由于您的回复,我突然到ipadpeek.com 进行检查,发现没有滚动...由于我没有实际的设备,我无法确认我应该信任哪个,但我想更倾向于苹果开发的一款。我不应该信任 iOS 模拟器吗?

标签: html css ipad


【解决方案1】:

这取决于您的屏幕分辨率。问题来了:

#containerLeft img{
position: fixed;
left: 0;
bottom: 0;
display: block;
}

底部属性在高分辨率屏幕上为您提供更多空白。

【讨论】:

  • 我该如何编码,这样图像也会出现在 iPad 屏幕的底角? Position: absolute 也不行。
  • @Ethan22 我会试着找一个有 Ipad 的人来为你测试一下。可能是模拟器正在读取您计算机的屏幕尺寸并将其转换为“ipad”模拟器。
  • 当iOS模拟器。试图保持一定程度的自给自足,但如果无法帮助...好的,会的,谢谢您的帮助。
猜你喜欢
  • 1970-01-01
  • 2011-04-27
  • 2019-06-10
  • 1970-01-01
  • 2019-05-27
  • 2016-12-08
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多