|
|
Cascading Styles Sheets
|
|
Cascading Style Sheets (CSS) need Netscape 4.5 and Internet Explorer 4.0 or above. CSS are a way of setting a style for one web page, or a whole web site, from one master style file. You can define styles of text etc., in this master file, and then 'call' it into use with each seperate web page. This means that you can, in one easy motion, affect the whole page, and/or whole site with just one change on the master style sheet. Master style sheets are plain ASCII and created using a text editor like 'Notepad'. So, if you created the following master style sheet
and saved it as "sheet.css", in the same folder/directory as your HTML files (important!) [NOTE: '1.0em', a unit of length, is used in the font-size parameter instead of 18px (pixel) or 10pt (point) because 'px' or 'pt' are absolute settings. Although using 'px' or 'pt' means your text will usually appear the right size regardless of the settings on the user's browser or monitor, it means that the zooming functions [CTRL+scroll-wheel in IE and CTRL+'+' or'-' in Netscape] are unusable. This is not good for accessibility.] Then insert the following in your web-page between the <HEAD> & </HEAD> tags:
you could then call the style into action like this:
and all your text after the <FONT> tag would be arial and white. Now imagine that you've used 10 paragraphs on 20 pages, and decide that you prefer comic sans ms, blue, all you need to do is make one change to the master sheet thus:
save it, reload/refresh your browser and instantly ALL your pages take up the new style - yahzoo! and if you want it bold as well?
Imagine if you had defined all your <FONT> tags in the old way, seperately on each page? That would be about 200 changes to be made, instead of one. Good innit!
In-line Styles Of course, you can also use styles on individual pages, but that rather defeats the object. However, one excellent use is for Absolute positioning For instance:
will position the graphic's top left hand corner, 30 pixels in from the left, and 40 pixels down from the top. You can position tables:
and paragraphs:
in the same way. If you would like to view the master style sheet ["curious-v2.css"] for this site: Click Here For mucho more on CSS visit: http://builder.cnet.com/ |
|
|
|
|
||
|
|
|
|
|
||
All original material ©2000 The Curious? Web Site