http://simonmacdonald.blogspot.com/2012/01/on-eight-day-of-phonegapping-multiple.html
Simon Mac Donald
http://hi.im/simonmacdonald
> --
> You received this message because you are subscribed to the Google
> Groups "phonegap" group.
> To post to this group, send email to phon...@googlegroups.com
> To unsubscribe from this group, send email to
> phonegap+u...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/phonegap?hl=en?hl=en
>
> For more info on PhoneGap or to download the code go to www.phonegap.com
#wrapper {
width: 90%;
min-width: 0;
}
#main {
margin-left: 0;
}
#sidebar {
width: auto;
float: none;
}
We'll set our wrapper div to have a width of 90% because we don't want any text going right up against the screen as it make it hard to read. We'll give our main content a left margin of 0px so it is left justified against the wrapper div. For our sidebar we'll make the width auto so all the text will fit. So you app will look like this:#wrapper {
width: 80%;
margin: auto;
}
#main {
margin-left: 40%;
}
#sidebar {
width: 40%;
float: left;
}
The first thing you will notice in the CSS is that the wrapper div width is now 80% as we have more screen to work with so we can pad the sides a bit more. The main div is going to float over to 40% of the width of the wrapper div and the sidebar will be 40% of the wrapper div floating to the left side. And your app would look like this:@media all and (max-width: 800px) { ... }for the phone version of the CSS and:@media all and (min-width: 801px) { ... }for the tablet version. Simply screens up to 800px will get the phone version of the CSS and any screen over 800px wide will get the tablet version.<!DOCTYPE HTML><html><head><meta name="viewport" content="user-scalable=no" /><meta http-equiv="Content-type" content="text/html; charset=utf-8"><title>PhoneGap</title><style type="text/css">@media all and (min-width: 801px) {#wrapper {width: 80%;margin: auto;}#main {margin-left: 40%;}#sidebar {width: 40%;float: left;}}@media all and (max-width: 800px) {#wrapper {width: 90%;min-width: 0;}#main {margin-left: 0;}#sidebar {width: auto;float: none;}}</style><script type="text/javascript" charset="utf-8" src="phonegap-1.3.0.js"></script><script type="text/javascript" charset="utf-8">function onBodyLoad() {document.addEventListener("deviceready",onDeviceReady,false);};// PhoneGap is ready//function onDeviceReady(){console.log("Width = " + window.innerWidth);console.log("Height = " + window.innerHeight);}</script></head><body onload="onBodyLoad();"><div id="wrapper"><div id="sidebar">sidebar</div><div id="main">main</div></div></body></html>