The Wayback Machine - https://web.archive.org/web/20081206191927/http://www.webreference.com:80/html/tutorial5/10.html


spacer

Webref WebRef   Sitemap · Experts · Tools · Services · Newsletters · About i.com

External Style Sheets

Developer News
Google Chrome Playing Catch-Up on Extensions
Open Solutions Alliance Gets New Leadership
Red Hat Spacewalk Expands Linux Management

You have seen how you can use a style sheet in the document head to affect the presentation of your entire document. However, if you have a large number of documents, it would be nice to be able to use a single style sheet for all of them. This is indeed possible, and the easiest way to use CSS with HTML.

All you have to do is put the style sheet into a separate file and use the LINK element to link to it, like this:

<LINK
 REL="Stylesheet"
 TITLE="Default Stylesheet"
 MEDIA="Screen"
 HREF="style/default.css"
>

Remember that the value of the HREF attribute is the URL of the stylesheet itself. Now you can dispense with the STYLE element altogether, put your style rules in a separate file and just link to it from all of your documents. Here you see another advantage to using CSS over arbitrary elements to affect presentation. If you have a whole big bundle of documents linked to a single style sheet in this way, you can change their style by simply changing the style sheet, with no need to re-edit every HTML document individually.

This tutorial should have taught you the basics of CSS. You now know how to insert declarations into your document, how to build rule sets and put them in style sheets that can be embedded into the document or linked to it externally.

However, you probably have a whole lot of questions. Things like, what if an element matches more than one selectors and they have conflicting declarations? What if it also has a STYLE attribute? What takes precedence? Well, that's the Cascading part of Cascading Style Sheets, and it's a mondo chapter that we'll get into later on.

Not to mention the obvious question, what in the name of <insert preferred deity> do all the properties and values do and how do I use them?!?. Patience, dear reader, for all will be revealed in future HTML with Style tutorials, coming to a URL near you soon.

Front Page12345678910

http://www.internet.com

Produced by Stephanos Piperoglou

internet.comearthweb.comDevx.commediabistro.comGraphics.com

Search:

Jupitermedia Corporation has two divisions: Jupiterimages and JupiterOnlineMedia

Jupitermedia Corporate Info

Copyright 2008 Jupitermedia Corporation All Rights Reserved.

Legal Notices, Licensing, Reprints, Permissions, Privacy Policy.
Advertise | Newsletters | Tech Jobs | Shopping | E-mail Offers

webref The latest from WebReference.com Browse >
Administering MySQL Databases on the Web Using PHP · Popular JavaScript Framework Libraries: An Overview - Part 3 · Accessing Your MySQL Database from the Web with PHP
Sitemap · Experts · Tools · Services · Email a Colleague · Contact FREE Newsletters 
 The latest from internet.com
VoxOx Tames the Tumultuous Communications Tangle · Buffalo Technology Can Sell Again in U.S.—For Now · OCZ Unveils the CrossOver USB 2.0 Flash Drive


All Rights Reserved. Legal Notices.

URL: http://www.webreference.com/html/tutorial5/10.html
Created: August 20, 1998
Revised: August 20, 1998

Morty Proxy This is a proxified and sanitized view of the page, visit original site.