2011-03-16 337 views
2

我有一个很多超链接的小html页面,当我查看相同的页面是一台计算机上的web浏览器,看起来没问题,当我查看iphone中的html页面时,这些字母非常小&很难阅读。自动调整大小的HTML页面

如何使相同的HTML看起来自动调整大小,如果你在iphone &浏览器在电脑中查看?

谢谢。

回答

0

你必须做一个移动的CSS。

使用Mobile Device Detect PHP代码为:

require_once('mobile_device_detect/mobile_device_detect.php'); 

$mobile = mobile_device_detect(true,false,true,true,true,true,true,false,false); 

echo ($mobile) ? '<link rel="stylesheet" media="all" href="css/mobile.css" /><meta content="True" name="HandheldFriendly" /><meta content="width=device-width; initial-scale=1.0; maximum-scale=1.0; user-scalable=0;" name="viewport" />' : '<link rel="stylesheet" media="all" href="css/main.css" />'; 

echo '<body'.($mobile ? 'onload="window.scrollTo(0, 1)"' : null).'>' ; 
+0

Thanks.Can't它做@ HTML的水平,我没有在我的项目中使用PHP。 – Sharpeye500 2011-03-17 00:22:17

+0

这是不可能的,[javascript是不可取的](http://stackoverflow.com/questions/743129/mobile-detection-using-javascript/743139#743139) – 2011-03-17 01:09:56