What are Stylesheets?

Question: I have read your article on specifying fonts, but I do not know what a style sheet is or how to make one.

Answer: A stylesheet is what you use to define how your web page should appear (which fonts, how big, colours etc). You can attach a stylesheet into the head section of a page by enclosing the stylesheet commands in <style> </style> tags but the better alternative is to create a separate file with a .css suffix (eg. master.css) and link that into all of your web pages using <link rel="stylesheet" href="master.css" type="text/css" />.

The separate file solution means that you can then link the same stylesheet into all of the pages on your site and then at a later date change the appearance of all of the pages simply by changing the stylesheet file.

You can also add a media attribute to the style or link tag or wrap parts of the stylesheet inside of media commands in order to apply the styles to specific media only - for example you can set completely different styles for when the page is printed to the styles to be applied to the page when viewed on a computer screen.


This article written by Stephen Chapman, Felgall Pty Ltd.

go to top

FaceBook Follow
Twitter Follow