我正在为iphone编写一个网站。我们的设计师给我320 x 480的大小的图像,所以我编码的网页也基于这个大小。然而,当我在iphone上预览时,网站看起来非常小。如何解决这个问题?
我的容器大小是320px。
谢谢。
发布于 2011-02-11 14:25:57
在顶部尝试这个
<!DOCTYPE html PUBLIC "-//WAPFORUM//DTD XHTML Mobile 1.0//EN" "http://www.wapforum.org/DTD/xhtml-mobile10.dtd">
...and on your body
<div style="width: 320px; margin: 0 auto;">
<!--some code here-->
</div>然后你可以在http://testiphone.com/上测试它...
发布于 2011-02-11 14:26:05
尝试将以下meta元素添加到标头中:
<meta name="viewport" content="width=device-width; initial-scale=1.0; maximum-scale=1.0; user-scalable=0;" />然后将容器宽度设置为100%。该标记最初由Safari支持,但现在许多其他移动浏览器都支持它。
请记住,如果用户将他们的设备旋转到横向透视,宽度将是480px。如果您打算让用户将设备保持在纵向模式,则可以将设备宽度设置更改为320。
发布于 2017-08-16 20:12:22
使用以下代码:
<div style="width: 100%; margin: 0 auto;">
<!--put other code here-->
</div>https://stackoverflow.com/questions/4966095
复制相似问题