[thelist] CSS

Charles F. Johnson charles at littlegreenfootballs.com
Sun Jun 10 20:00:04 CDT 2001


Gary Finnigan <gfinnigan at talk21.com> typed:

> I am in the process of using a CSS file to control the 'normal' part of the
> site. I would like people to be able to click on a link and load in a
> different style sheet that will allow them to view a greater font size.
> I know this can be done, but don't know how.
> Can anyone help?

if you can use PHP on this site, it's pretty easy. just make links to the
various stylesheets like so:

<a href="mypage.php?css=style1.css">Tiny fonts</a>
<a href="mypage.php?css=style2.css">Readable fonts</a>
<a href="mypage.php?css=style3.css">Huge fonts</a>

then in the <head> section of your page, where you'd normally put the link
to the stylesheet, use something like this instead:

<?php
if (isset($css)) {
  echo "<link rel=\"stylesheet\" href=\"$css\" type=\"text/css\">\n";
} else {
  echo "<link rel=\"stylesheet\" href=\"default.css\" type=\"text/css\">\n";
}
?>

if you want to get extra fancy, you could also use cookies to store the
user's prefs and set them automatically when they return.

charles johnson
lgf web design
http://littlegreenfootballs.com





More information about the thelist mailing list