34,333
edits
Changes
→Importing an External Style Sheet into a Web Page
Whilst it is possible to include all your CSS styles by embedding them into each HTML page this, to a certain degree, defeats one of the main objectives of CSS. It is much better to place the styles in a separate CSS file and import that file into each weeb page. This means that a change to the overall style only needs to be made to the external file in order for the change to take effect in all pages that include it.
First, we can create our external CSS file. This is the same concept as outlined for embedding the styles into an HTML file, except the <script> tags are not required. For example we can create CSS filed myStyle.css as follows:
<pre>
H1 { color: red}
H2 {font-weight: bold }
</pre>
To include our style sheet into a web page we simply use the ''<link>'' tag:
<pre>
<link rel="stylesheet" type="text/css" href="myStyle.css">
</pre>
== Creating CSS Rules ==