[[#wd Lookup TitleRecipe14 ]]

Overview

Style Sheets give you the possibility to define the format of different HTML commands (font-type, font-size, bold, ...). If you like to change the 'look' of your page - just change the specific entry in the style sheet definition. You can define style sheets directly in the *.html files, no change is needed in the *.any files. Or you can define all (or most of them) in one or more specific *.css files. In that case you need this recipe.

But be aware that style sheets are relatively new. They exists since 1996 (CSS-Version 1.0, 1998 CSS-Version 2.0). Netscape support this feature since version 4.0 and InternetExplorer since version 3.0.

Preconditions

Steps to do:

  1. Just add the definition for /StylePath and the specific MIME-Type to the Server.any (similar to images):
    [[#wd DisplayAnythingRenderer {
    	/AnythingInfo {
    		"/StylePath		    "/static/styles/""
    	 	"..."
    		"/Ext2MIMETypeMap {"
    		"	/gif	"image/gif""
    		"	/jpg	"image/jpeg""
    		"	/css	"text/css""
    		"}"
    	}
    }]]
    
  2. Define a style sheet file (*.css). Put it into the directory defined in /StylePath.
    Formats.css:
    [[#wd DisplayAnythingRenderer {
    	/AnythingInfo {
    		"/* style definitions for Coast Cookbook */"
    		"p,h1,h2,h3,h4,ul,ol,li,div,td,th,address,blockquote,nobr,b,i,a"
    		"	{ font-family:"Frutiger 55 Roman", Helvetica, Arial; }"
    		"..."
    	}
    }]]
    
  3. Put in the appropriate html definition into the <head> section of the central html file.
    SharedPageLayout.html:
    [[#wd DisplayAnythingRenderer {
    	/AnythingInfo {
    		"<link rel=stylesheet type="text/css" href=[[#wd Lookup StylePath ]]Formats.css>"
    	}
    }]]
    

Remarks

This recipe allows you to handle different MIME-Types with Coast.

Glossary

Style Sheets (CSS)

Related Topics