Tuesday, January 10, 2012

CSS: Including CSS in a Document


By Richard York

CSS is very flexible regarding how you call it in a document. You can include CSS in a document in four ways:

CSS can be included in a document by using embedded style sheets, which are included between tags directly in an HTML document, as demonstrated in Figure 2-26. These tags must appear between the and tags.

Figure 2-26 

CSS can be included in its own document and linked to an HTML document by using the element, shown in Figure 2-27.
Figure 2-27 

CSS can be imported from within another style sheet by using an @import rule, as shown in Figure 2-28.
Figure 2-28 

CSS can be included directly in an element in an HTML document by using inline styles with the style attribute, as shown in Figure 2-29.
Figure 2-29 

Each method has its own particular usefulness. The upcoming sections describe how you can use each of these methods to include CSS in an HTML document.




No comments: