I've been applying my styles via inline code all this time. Can someone give me a refresher on how to link an external style sheet by providing an example?
We Rock Your Web Forum » Markup Languages » CSS
CSS External Style Sheet Example?
(4 posts)-
Posted 2 years ago #
-
Posted 2 years ago
-
No problem Andy. Just add the following in the header of your web page file:
<head>
<link rel="stylesheet" type="text/css" href="styles.css" />
</head>Note the XHTML compliance.
Posted 2 years ago # -
Cool beans, thanks. What about the third way to do it - where the code comes in the header? I think it's called an internal style sheet?
Posted 2 years ago # -
Yep, there's three ways to do a stylesheet:
- External (shown above)
- Internal
- Inline
Examples of the last two follow:
Internal:
<head>
<style type="text/css">
styles...
</style>
</head>Inline:
<p style="styles...">Bla bla.</p>You can also import a stylesheet:
<style type="text/css" media="all">@import "/styles.css";</style>Although I think importing a stylesheet uses more overhead than the direct external method.
Posted 2 years ago #