iPad HTML5 design
May 29th, 2010 Posted in Computers, Hobby | No Comments »Since a little bit I have been playing with the new Apple iPad and I have to say it is great. As a technology lover and hobby programmer, of course I had to dive in and test a view things myself. The first thing that cought my eye was the rotation and possibilities it gives for webdesign and therefore I was very surprised to learn that this is already supported in the new HTML5 (draft?) spec.
Anyways I want to share how you can make a page that looks different based on how you hold your iPad, which is actually quite simple.
You need two style sheets, one for each orientation of your iPad. Lets call them portrait.css and landscape.css. In your head definition of your page you put:
<link rel="stylesheet" media="all and (orientation:portrait)" href="portrait.css"> <link rel="stylesheet" media="all and (orientation:landscape)" href="landscape.css">
Also helpful if you want to start defining absolute sizes for your sheets depending on how you look at them, you can use:
<meta name="viewport" content="initial-scale=1.0"> <meta name="viewport" content="maximum-scale=1.0"> <meta name="viewport" content="minimum-scale=1.0">
With a quick definition of portrait.css and landscape.css you are now able to transform the look of your page based on the orientation!
In a follow up post, I will add some examples and also some other useful JavaScript I found that helps in making more advanced pages.
Enjoy!