View Single Post
  #15 (permalink)  
Old 02-03-2006, 06:15 AM
RJ38 RJ38 is offline
WebProWorld Member
 
Join Date: Oct 2003
Location: Bay Area, California, USA
Posts: 82
RJ38 RepRank 0
Default Why one resolution or another, when you can set for them all

I have found, and use this script to adjust page and font size so they can be rendered properly in any resolution.

Simply write a js file, name it choose_css.js,

Code:
// choose_css.js
  // -------------
  // choose the appropriate stylesheet according to
  // the user's screen resolution

  document.write("<link rel='stylesheet' type='text/css' href='");

  if (window.screen.height <= 600) {
    //resolution is 800x600 or less
    document.write("cs1.css'>");
  } 
else if (window.screen.height <= 768) {
    //resolution is 1024x768 
    document.write("cs2.css'>");
  }
else {
    document.write("cs.css'>");
  }
Place this in the head of your pages,
Code:
<script language="javascript" type="text/javascript" src="choose_css.js"></script>
Then design your css files (cs1.css for 800X600, cs2.css for 1024x768, cs.css for others)for the resolution being called. The larger resolution pages can have larger font size to make the reading easier. Of course you can modify it to call any resolution you choose to.

For more info just Google, choose_css.js
__________________
I started an Internet business so I could work normal hours...

what happened?
Reply With Quote