DACS
Resource
Center
Ives Manor
(lower level)
198 Main Street Danbury.
For information contact:
Annette van Ommeren
(aka "Anna Collens")
Join Us!
Just show up or send an email so you can be notified of upcoming meetings.
Intro to Cascading Style Sheets |
|
Cascading Style Sheets (.css) are
the best way to control and manage a web site, some advantages
include: |
|
|
|
One (or more) external style sheets
can control the visual look of multiple pages. And a simple change
to the style sheet will change all instances where that style is
used. |
|
|
|
Some possible disadvantages: |
|
|
|
Types of style sheets: |
|
|
|
CSS can be used to modify: |
|
|
|
| Declaration: | |
To make sure browsers interpret CSS correctly, make sure this
declaration is placed above the start of the html code of the
page |
|
| EXTERNAL .CSS: | |
|
|
INTERNAL .CSS: |
|
|
|
Example of the code for an internal .css style |
< style type="text/css"> < !—- .basictext { font-family: "Courier New", Courier, mono; font-size: 12px; color: #009933; }--> < /style> |
Styles: Classes: |
|
|
|
Re-defining HTML tags: |
|
|
|
Example: |
<style type="text/css"> < !— h4 {font-family: "Courier New",Courier, mono; font-size: 14px; color: #0099CC; }--> < /style> |
Changing
the default link format and behavior: |
|
CSS can change color/fonts/background
etc for each of the 4 states of links: |
a:link a:hover a:active a:visited (Netscape may confuse things!) |
Example of a .css link code: Click here to
|
a:link { font-family: Verdana, Arial, Helvetica, sans-serif;font-size: 14px; color: #993300; text-decoration: none; padding: 2px; width: 200px; background-color: #FFF0E1; } |
Additional possibilities
with .css-2: |
|
A seperate .css can be set for print: 1 for screen and 1 for print. |
|
The links in the page: |
|
To exclude certain items from a print out Define it as a class=“noprint" then put in the css file for print only: |
p.noprint { display: none; } |
Can start with the “screen” styles and modify them for print.
|
|
| Handhelds can butcher tables, if they recognize them at all - use CSS positioning.
Use "display: none" to hide navigation columns, images, advertising. If you put the handheld stylesheet after the screen stylesheet in your code, then use "display: none" for whatever you don't want going to a handheld. It may work even if the handheld tries to read the screen stylesheet. |
|
Always make sure the external .CSS
files are uploaded to the server in the same folder hierachy as
on the local site! |
|
| (Slightly off-topic, but worth knowing) | |
After making javascript rollovers, you can put them in an external javascript file. This lightens the HTML of the page |
<script language="JavaScript" type="text/JavaScript"src=rollfile.js> </script> Where the “rollfile.js” is the name of the external javascript file |
Additional Links of interest: http://www.w3.org/TR/REC-CSS2/ |
|

