View Full Version : Selecting Stylesheet On Screen Resolution

08-29-2004, 05:31 PM
I need a piece of script that will select style800.css if the screen resolution is 800x600 or below, and style1024.css if the screen resolution is 1024x768 or above.

Can anyone help? I've been looking for ages.


08-29-2004, 05:56 PM
<script type="text/javascript">if(screen.width>800){document.write('<link rel="stylesheet" type="text/css" href="style1024.css" />');}else{document.write('<link rel="stylesheet" type="text/css" href="style800.css" />');}</script>


08-29-2004, 06:38 PM
Screen resolution has little to do with the size of the browser window your site is displayed in...
Provide two style-sheets (one default, another alternative) and let user decide which one they want.

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum