Linking a CSS style sheet
A stylesheet placed in an external file can be linked in your HTML document with the LINK tag placed inside the document HEAD. Here are the most important attributes you should be aware of:
- type is optional and the only allowed value is "text/css". It helps browsers that do not understand CSS to ignore the stylesheet altogether rather than trying to parse it.
- href is the (absolute or relative) URL to the stylesheet you want to load. Think of it like the src attribute of IMG.
- media allows you to specify which type of media the current document will be displayed on. You will most commonly want to define different stylesheets for "screen" and "print".
- rel can be either "StyleSheet" or "Alternative StyleSheet". The values are pretty self-explanatory. Alternative stylesheets can be used to allow your visitors to customize the look of your site.
- title should be the name of your stylesheet, in case you define more alternatives.
HTML Example:
Share Tweet