After looking through Mozilla Developer Network min-width compatibility reference, if you want to not use %'s that be fine. However, if it were me, I would typically create a webpage to normally be around 600-800px wide max anyways. Most based on content and what not.
Most people today don't normally have computers with resolutions below 1024x768 anyways. If they do then chances are they are not browsing the web with it. I would just keep my website's width below 1024, and for the most part you should be fine.
Just my 2 cents though.
If you still want to resize the pages content I would do something like this:
- var standardW = [800,1024,1152,1280,1400]; // these are just the resolutions my monitor supports
-
var desiredW = []; // fill with what you want your widths to be based on monitor View Port, and make sure you match what you want with the same array #
-
// Again heights are not really a big deal unless you want your webpage to exactly fit the screen.
-
-
for ( var i=0; i<standardW.length; i++ ) {
-
if ( viewportwidth == standardW[i] ) {
-
document.getElementById("ContentBody").style.width = desiredW[i];
-
break;
-
}
-
}
There will always be a chance that a user will have a random obscure width size, so if the standardW isn't reached, you'll have to check the viewport to be within a certain range. like:
- if ( viewportwidth > 800 && viewportwidth < 1024 ) { ... }
This is another reason why I'd just make a webpage just one size. Just not too huge.