Inserting CSS
You can Insert CSS into your HTML document in three simple ways:
- External stylesheet
- Internal stylesheet
- Inline styling
Let’s begin with the cleanest way, the external stylesheet. This is done using a CSS file, the usual file extension for this is .css, but any plain text file works. The most common way of inserting from an external stylesheet is with the HTML link element:
<link href="stylesheet.css" rel="stylesheet" type="text/css" />
An internal stylesheet is simply putting your CSS inside the HTML document, usually within <head>. Let’s see the exmaple:
<style type="text/css">
/* Your CSS here */
h1{ color:red; }
</style>
Inline styling is very simple to do, but if used too foten can make your documents overly complex, and defeats the point of CSS, you should try and avoid inline styling wherever you can. Here’s an example of it:
<h1 style="color:red;">CSS is a good thing!</h1>
