Showing mobile friendly web page without having to zoom in

心已入冬 提交于 2019-12-14 03:46:54

问题


I'm trying to create a mobile friendly web page using the code below. When I view it over a HTC desire I have to zoom in to see the correct size. How can I get it to display normally without having to zoom in?

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="MobileSite._Default" %>


<!DOCTYPE html PUBLIC "-//WAPFORUM//DTD XHTML Mobile 1.2//EN" "http://www.openmobilealliance.org/tech/DTD/xhtml-mobile12.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >

<head runat="server">
    <title>My Mobile Site</title>
</head>
<body style="width: 480px">
    <form id="form" runat="server">
    <div>    
        Test<br />
        Test<br />
        Test
    </div>
    </form>
</body>
</html>

回答1:


I'm not sure if the HTC supports the viewport meta tag the same way the iPhone does, but you can try:

<meta name="viewport" content="width = 320" />

(or some other width) or:

<meta name="viewport" content="initial-scale=1" />



回答2:


AFAIK only webkit based browsers respect viewport. If you don't set size for table and div and keep mobile doctype most of the browsers should fit it properly to the screen



来源:https://stackoverflow.com/questions/2726040/showing-mobile-friendly-web-page-without-having-to-zoom-in

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!