The below is just an alternate way to your problem, I dont know how complex you want to go, but I would follow applying different css depending on the device. PLEASE CONSIDER THE COMPLEXITY OF YOUR PROJECT.
If the website is going to b viewed on multiple devices, I would suggest using different CSS for different devices / browsers.
<link rel="stylesheet" media="screen and (min-device-width: 500px)" href="500example.css" />
The above code will apply the said css to devices with witdh of 500 and above.
This is a neat way of ding it as it checks for the device width and not the browser width, as this is very useful when using mobile / hand held devices.
Another way is to check the browser width.
<link rel='stylesheet' media='screen and (min-width: 500px) and (max-width: 800px)' href=example2.css' />
The above code will apply the style sheet only if the browser window is between 500px and 800px.
You can write a function to check the conditions to apply the css.
Add the files
<link rel="stylesheet" type="text/css" href="main.css" />
<link id="size-stylesheet" rel="stylesheet" type="text/css" href="example2.css" />
Every time the window is adjusted you can check for the css to apply, [Add jQuery]
function adjust(width) {
width = parseInt(width);
if (width < 701) {
$("#size-stylesheet").attr("href", "css/ex1.css");
} else if ((width >= 701) && (width < 900)) {
$("#size-stylesheet").attr("href", "css/ex2.css");
} else {
$("#size-stylesheet").attr("href", "css/wide.css");
}
}
$(function() {
adjust($(this).width());
$(window).resize(function() {
adjust($(this).width());
});
});