Friday, July 4, 2008

Adding CSS to an XHTML document

Inline Styles: These have the highest specificity. The CSS rules are located in the value of the style attribute. Eg. style="color: blue"
Embedded Styles: These have the second highest specificity. The CSS rules are contained within the <style type="text/css"> tag.
External Stylesheets:
There are two kinds:
Linked external stylesheet
This is loaded with <link rel="stylesheet" type="text/css" href="styles.css">
Imported external stylesheet
<style type="text/css"> @import url(styles.css);
The media can be specified for imported stylesheets in this way:
@import url(style.css) screen, handheld; Imported styles have the lowest specificity.

No comments: