Cascading Style Sheets - CSS

The HTML4 way to control HTML output

Style sheets are designed to bring some of the simplicity of word processing styles to HTML. You can define how certain sections of text and code will be displayed, even down to the font and size. You can change the way that existing HTML tags operate within your pages. e.g. the <p> . . . </p> tag can be redefined to change all the text within the tag to a specific font, size, indent, emphasis and position.

Style sheets aren't as new as they may seem. Internet Explorer 3 partially implemented style sheets but you should only expect CSS to function correctly when viewed in a version 4 or later browser - either Netscape or Microsoft.

The main advantage of style sheets is in making a consistent 'feel' for your site. By pre-defining all the styles you use, everything in the page can be organised sometimes without making any changes to the actual data. This is done by using an external style sheet that can be applied equally to all pages on your site:

<head>
<link rel="stylesheet" type="text/css" href="mycssfile">
</head>

This site uses external style sheets to achieve that consistent look and feel, by linking the same stylesheet to all similar documents. Whether internal or external, the style sheet is ignored by all older browsers. This leads to duplication in the common files as a body style is defined in the style sheet and in the html tag. This is not a problem - the CSS definition contains instructions to newer browsers to justify the text and to only use certain font families, a task that is beyond the capability of the HTML <BODY> tag anyway



This is part of www.codehelp.co.uk Copyright © 1998-2004 Neil Williams
See the file about.html for copying conditions.