2011-09-16 33 views
2

我們目前正在開發一個能夠顯示HTML5頁面的手機差距應用程序。 HTML頁面由填充內容和圖像的表格組成。它加載到設備上,但加載的頁面不適合屏幕。我們已將HTML元素的寬度設置爲100%,但頁面仍然不在屏幕上。PhoneGap應用程序的顯示尺寸不正確

<body onload="MM_preloadImages('images/index_54-.png','images/index_52.png','images/index_53-.png','images/index-_54.png')"> 
<table width="100%" border="0" cellspacing="0" cellpadding="0"> 
<tr> 
<td class="dibu"><table width="100%" border="0" cellspacing="0" cellpadding="0"> 
    <tr> 
    <td align="center"><a href="index.html" target="neirong" onmouseover="MM_swapImage('Image4','','images/index_52.png',1)" onmouseout="MM_swapImgRestore()"><img src="images/index_52-.png" name="Image4" width="128" height="117" border="0" id="Image4" /></a></td> 
    <td align="center"><a href="tssd.html" target="neirong" onmouseover="MM_swapImage('Image5','','images/index_54-.png',1)" onmouseout="MM_swapImgRestore()"><img src="images/index_53.png" name="Image5" width="128" height="117" border="0" id="Image5" /></a></td> 
    <td align="center"><a href="#" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Image6','','images/index_53-.png',1)"><img src="images/index_54.png" name="Image6" width="128" height="117" border="0" id="Image6" /></a></td> 
    <td align="center"><a href="zxxx.html" target="neirong" onmouseover="MM_swapImage('Image7','','images/index-_54.png',1)" onmouseout="MM_swapImgRestore()"><img src="images/index_55.png" name="Image7" width="128" height="117" border="0" id="Image7" /></a></td> 
    </tr> 
</table></td> 
</tr> 
</table> 
</body> 

請幫助,您的幫助將會受到很多apprieciated。

回答

0

你瞄準什麼設備?您可能需要確保已將主體的寬度設置爲100%,以便瀏覽器明確知道製作表的寬度,即:

html, body { 
    width: 100%; 
    height: 100%; 
    padding: 0; 
    margin: 0; 
} 

這將確保所有表的父DOM節點具有已知大小,因此表可以正確呈現。另一個要嘗試的是添加一個meta標籤到你的頭部,以確保移動設備(我假設你的目標是設置正確的顯示尺寸;

<meta name="viewport" content="user-scalable=no, width=device-width, initial-scale=1, minimum-scale=1, maximum-scale=1"/> 

如果您知道寬度,您可以將屏幕硬編碼爲該尺寸;

<meta name="viewport" content="user-scalable=no, width=480, initial-scale=1, minimum-scale=1, maximum-scale=1"/> 

也許應該使用媒體查詢來定位您的正確的設備CSS(的iPhone 3G .V。的iPhone 4)等

相關問題