iPhone Safari横向定位CSS问题

时间:2012-12-04 17:23:51

标签: iphone html css safari

如果您查看我的简单网站,它在浏览器中运行良好,但在iPhone上,该网站在横向方向上丢失了底部功能区。

为什么在横向时没有正确调整页面的高度? http://mtindustrialservicerequest.com/KenHolidayCard/holidayCardDemo/EmployeeCard2.html

HTML:

<!DOCTYPE html>
<html lang="en">
<HEAD>
<meta charset="utf-8">
</HEAD>
<BODY style="text-align: center; background-color:#e4e4e4; background-image:url(snowflakeBackground500x500.png); margin:0; padding:0;">
<div style="position: absolute; height: 100%; width: 100%; background-image:url(ribbon_Bottom2.png); background-repeat: repeat-y; background-position: center center;">
<div style="position: relative; width: 100%; height:325px; overflow: visible; top: 50%; margin-top: -170px; background-image:url(ribbon_Horizontal2.png); background-position: center center;">
<iframe width="650" height="325" src="http://www.youtube.com/embed/bFs89lAL7dE?&autoplay=1&rel=0&fs=0&theme=light&showinfo=0&controls=0&autohide=1&color=white" frameborder="0" allowfullscreen></iframe>
</div>
</div>
</BODY>
</HTML>

2 个答案:

答案 0 :(得分:1)

它实际上并没有完全消失。从纵向旋转到横向后,我点击刷新。它是可见的(大约8个像素)。

我会为您的CSS添加min-height:320px垂直功能区。 320或您可以使用的其他值。

答案 1 :(得分:0)

我通过将三个div叠加在一起来解决它 - 顶部和底部的色带,中间是视频和水平色带。顶部和底部高度为50%,底部/顶部边距可以补偿中间的325px视频。见下文。

<BODY style="text-align: center; background-color:#e4e4e4; background-image:url(snowflakeBackground500x500.png); margin:0; padding:0;">
<div id="div1" style="position: absolute; height: 100%; width: 100%;">
<div id="div2" style="position: relative; height: 50%; width: 100%; margin-bottom:-170px; background-image:url(ribbon_Bottom2.png); background-repeat: repeat-y; background-position: center center;"></div>
<div style="position: relative; width: 100%; height:325px; overflow: visible; background-image:url(ribbon_Horizontal2.png); background-position: center center;">
<iframe class="shadow" width="650" height="325" src="http://www.youtube.com/embed/bFs89lAL7dE?&autoplay=1&rel=0&fs=0&theme=light&showinfo=0&controls=0&autohide=1&color=white" frameborder="0" allowfullscreen></iframe>
</div>
<div id="div3" style="position: relative; height: 50%; width: 100%; margin-bottom: 170px; background-image:url(ribbon_Bottom2.png); background-repeat: repeat-y; background-position: center center;"></div>
</div>
</BODY>
</HTML>