I understand where to put the rules in the stylesheet, but I'm not sure where to put the other part of your code. Can you insert the class code in my code above?
Main Topics
Browse All TopicsI want to be able to check the screen resolution, then create a font style depending on which resolution is being used. Can't seem to get it to work.
<style type="text/css"><!--
body{margin-top:1;backgrou
a.type3:link {color:#FF8000; text-decoration:none;}
a.type3:visited {color:#FF8000; text-decoration:none;}
a.type3:active {color:#FF8000; text-decoration:none;}
a.type3:hover {color:#00CCFF; text-decoration:overline underline;}
//--></style>
<script language=javascript>
<!--
function checkres()
{
...check resolution....
if(screenresolution800x600
{
<h3 style="font-family: Arial; font-size: 12pt;">
}
else
{
<h3 style="font-family: Arial; font-size: 10pt;">
}
}
<body onload="checkres()">
<div style="text-align:center;"
<table border="0" style="border:1px solid #6E6650;margin:0 auto;" cellpadding="5" cellspacing="0" width="98%" background="main.bg.dots.g
<tr>
<td align="left"><a class="type3" href="http://atomixgames.i
<td align="center"><a class="type3" href="http://atomixgames.i
<td align="center"><a class="type3" href="http://atomixgames.i
<td align="center"><a class="type3" href="http://atomixgames.i
<td align="center"><a class="type3" href="http://atomixgames.i
<td align="center"><a class="type3" href="http://atomixgames.i
<td align="center"><a class="type3" href="http://atomixgames.i
<td align="center"><a class="type3" href="http://atomixgames.i
<td align="right"><a class="type3" href="http://atomixgames.i
</tr>
</table>
</div>
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
This is the method I recommend, where depending on the resolution, the javascript loads a particular stylesheet.
The 2 stylesheets are called "style800below.css" and "style1024below.css". For styles common to both resolutions, you can put the formatting style code directly between the <style type="text/css"></style> tags instead of having to include them in both CSS files. CSS files contain the style code ONLY and must *not* contain HTML tags, that includes <style></style> tags.
If you choose to accept this solution, please divide the points equally between GrandSchtroumpf and me. Thanks.
<head>
<title>...</title>
<script language="javascript"><!--
if(screen.width<=800){//80
document.write('<link href="style800below.css" type="text/css" rel="stylesheet" />');
}else{//everything above 800x600
document.write('<link href="style1024above.css" type="text/css" rel="stylesheet" />');
}
//--></script>
<style type="text/css"><!--
body{margin-top:1px;backgr
a.type3:link {color:#FF8000; text-decoration:none;}
a.type3:visited {color:#FF8000; text-decoration:none;}
a.type3:active {color:#FF8000; text-decoration:none;}
a.type3:hover {color:#00CCFF; text-decoration:overline underline;}
//--></style>
</head>
<body>
<div style="text-align:center;"
<table border="0" style="border:1px solid #6E6650;margin:0 auto;" cellpadding="5" cellspacing="0" width="98%" background="main.bg.dots.g
<tr>
<td align="left"><a class="type3" href="http://atomixgames.i
<td align="center"><a class="type3" href="http://atomixgames.i
<td align="center"><a class="type3" href="http://atomixgames.i
<td align="center"><a class="type3" href="http://atomixgames.i
<td align="center"><a class="type3" href="http://atomixgames.i
<td align="center"><a class="type3" href="http://atomixgames.i
<td align="center"><a class="type3" href="http://atomixgames.i
<td align="center"><a class="type3" href="http://atomixgames.i
<td align="right"><a class="type3" href="http://atomixgames.i
</tr>
</table>
</div>
</body>
The reason I suggested external stylesheets is because it will save the visitor loading time and also bandwidth for your site.
Anyway, for the method suggested by GrandSchtroumpf, this is what you need:
<head>
<title>...</title>
<style type="text/css"><!--
body{margin-top:1px;backgr
a.type3:link {color:#FF8000; text-decoration:none;}
a.type3:visited {color:#FF8000; text-decoration:none;}
a.type3:active {color:#FF8000; text-decoration:none;}
a.type3:hover {color:#00CCFF; text-decoration:overline underline;}
h3{font-size:12px;}/* 1024x768 above */
body.s1 h3{font-size:10px;}/* 800x600 below */
//--></style>
</head>
<body>
<script language="javascript"><!--
if(screen.width<=800){//80
document.body.className='s
}
//--></script>
<div style="text-align:center;"
<table border="0" style="border:1px solid #6E6650;margin:0 auto;" cellpadding="5" cellspacing="0" width="98%" background="main.bg.dots.g
<tr>
<td align="left"><a class="type3" href="http://atomixgames.i
<td align="center"><a class="type3" href="http://atomixgames.i
<td align="center"><a class="type3" href="http://atomixgames.i
<td align="center"><a class="type3" href="http://atomixgames.i
<td align="center"><a class="type3" href="http://atomixgames.i
<td align="center"><a class="type3" href="http://atomixgames.i
<td align="center"><a class="type3" href="http://atomixgames.i
<td align="center"><a class="type3" href="http://atomixgames.i
<td align="right"><a class="type3" href="http://atomixgames.i
</tr>
</table>
</div>
</body>
First of all, you should create pages that are resolution independent.
But if you still feel you need to cutomize a page, SCREEN SIZE IS IRRELEVANT. Base it on browser window width. For example, my screen width is 1600 pixels, but I have my browser window only taking up 800 pixels, just half that space.
Business Accounts
Answer for Membership
by: GrandSchtroumpfPosted on 2005-09-17 at 10:49:35ID: 14904653
set a class on your <body> element depending on the resolution:
) {
if(screenresolution800x600
document.body.className = "Resolution800";
}
Then add these rules in you stylesheet:
h3 {
font-size: 12px;
}
body.Resolution800 h3 {
font-size: 10px;
}
Note that "pt" is for printed medium, for screen you should use "em" or "px", or (even better) use percentages.