Re: Subject: dynamic font
| From: | neil smith | Date: | Wed, 06 Nov 2002 12:16:24 +0000 |
| Subject: | Re: Subject: dynamic font | ||
| References: | 1 | Groups: | php.windows |
| Request: | Send a blank email to php-windows+get-16750@lists.php.net to get a copy of this message | ||
Hi -
Really it doesnt make sense to do this using PHP. CSS (cascading stylesheets) provide all that is required to offer different font sizes. You can use a simple bit of javascript which detects the users screen resolution, and then use document.write to write out a style sheet link suited to your users screen.
One stylesheet might contain
P {
font-family: Geneva, Arial, Helvetica, sans-serif;
font-size : 12px;
}
One for a bigger screen might have
P {
font-family: Geneva, Arial, Helvetica, sans-serif;
font-size : 14px;
}
Just save the file as style1.css the second as style2.css then :
<script language="javascript1.2">
if (screen.width > 640) {
document.write('<link rel="stylesheet" href="style1.css">');
// Suit screen size 640 px
} else {
document.write('<link rel="stylesheet" href="style2.css">');
// Suit screen size 800px or greater
}
</script>
Obviously, you can add all sorts of styles - TD cells might have different font sizes and font families again, so in our stylesheet use
TD {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size : 10px;
}
etc etc
Hope that helps.
Best regards,
Neil Smith.
At 02:52 06/11/2002 +0000, you wrote:
Message-ID: <3DC78D6D.FAA67EC6@infocamere.it> Date: Tue, 05 Nov 2002 10:20:45 +0100 From: Franco Pozzer <franco.pozzer@infocamere.it> Subject: dynamic font I want to calibrate/balance dinamically the font size of my application in the html tag depending of the resolution screen. Example if I have 800x600 I must be to use a font size or if I have 1024x766 another font size. Have you same idea to resolve this my problems?? Sameone have a sample code for me??? Thanks again for all. www.infocamere.it franco.pozzer@infocamere.it