Changes

Understanding Cascading Style Sheets (CSS)

1 byte removed, 14:58, 4 June 2007
no edit summary
== Embedding CSS Styles into a Web Page ==
CSS style styles can be embedded in an HTML document using the <style> tag as follows:
<pre>
</pre>
The above style settings as setting has the effect of making all &lt;H1&gt; headers in the web page appear in red.
== 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 web 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>
and it is also common to apply a single rule to multiple HTML tags by comman comma separating them:
<pre>
</pre>
having Having defined the ''id'' we can now create a CSS rule specifically for this element ''id'' by prefixing the id with a ''#'' character:
<pre>