Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

reformat a simple html page on an iphone

Tags:

html

iphone

I have a html called today.html and I use it on my iphone and I have to zoom in to see my tasks how can I have it formated correctly so that I it warps around the screen on the iphone and the text is the right size

here is my code

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
   "http://www.w3.org/TR/html4/strict.dtd">

<html lang="en">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <title>Tasks for today</title>
    <meta name="generator" content="TextMate http://macromates.com/">
    <meta name="author" content="sebastian stephenson">
<style type="text/css" media="screen">
    body {
        border: medium dashed #7979ff;
        background-color: #fff;
        margin: 0 auto;
    }

    body p{
        font: 2em "Helvetica Neue", Arial, Helvetica, Geneva, sans-serif;
        padding-left: 10px;
    }

    .todos {
        font: 1em"Lucida Grande", Lucida, Verdana, sans-serif;
        color: #7D1518;
        padding-left: 20px;
    }
    .todos p{
        font: 1em Arial;
    }
</style>
<!-- Date: 2008-08-24 -->
</head>

<body>
<p>a greeting</p>
<div class="todos">

<li>a task</li>

<li>a task with detail</li>
<p>detail</p>
<li>a task with muilple acitons</li>


<ul>

<li>an action</li>

<li>an action</li>

<li>an action</li>

<li>an action</li>

<li>an action</li>

<li>an action</li>

<li>an action</li>



</ul>


</div>
</body>
</html>

thanks

like image 445
sebey Avatar asked Mar 01 '23 23:03

sebey


2 Answers

Have you tried setting the viewport to fit the iphone screen size?

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

see more details at: constrain-your-viewport-for-iphone-web-development
Also see developer.apple.com for other factors regarding iPhone web development (such as Adjust Text Size for Readability)

like image 98
Dror Avatar answered Mar 11 '23 01:03

Dror


Have a look here

Quote:

If you are a CSS expert, your first thought will be to use the "handheld" media type in your CSS code. For instance, if a browser considers itself a handheld device, this code will hide all elements that belong to the navigation CSS class. That's handy if you know that these elements are convenient but redundant and take up more space than a handheld user wants to give up:

@media handheld {
    .navigation {
       display: none;
    }
}

Unfortunately this won't work on the iPhone. Why? Because Apple knows that the iPhone can display a page much better than most handhelds. And they didn't want the iPhone to display all web pages in a "dumbed-down" way. So the iPhone looks at the "screen" media type, just like your desktop browser does.

Is there an alternative? Yes! You can specify that a set of CSS rules apply only when the screen is smaller than a certain resolution:

@media only screen and (max-device-width: 480px) {
   .navigation {
        display: none;
   }
}
like image 41
epatel Avatar answered Mar 11 '23 01:03

epatel