Getting Started HTML: The Basics More Than HTML: Audio Help Desk: Quick Reference Free Stuff:
|
Style SheetsStyle sheets are basically templates that control the appearance of your page on the screen. Browser versions capable of reading Cascading Style Sheets are: MS Internet Explorer 3.0+, Opera 3.0+, and Netscape Navigator 4.0+. For a complete list of browser compatibility visit Webreview. To read more about CSS visit World Wide Web Consortium (W3C). Ok, let's get to the basics:
The above code is the 'container' for all style specifications. It will appear in the <head> of the document.
Breaking it all down, First line: effects the color of the links. For large or complicated style sheets, you can create a separate file and link it to your documents: First create a file named style.css in a ASCII text editor containing all of your style information:
Or, you can import the style sheet file in the style element:
Multiple external style sheets are possible by adding multiple <LINK=> elements or @import statements. Where the styles conflict, the last links or imports will override previous ones, and those will be overridden by rules within the HTML document itself. This is where cascading rules apply: if two style sheets define competing rules, the innermost style sheet is used. So far, we have discussed style definitions that apply to the entire document. Now let's look at how to apply style to a single element occurance. This can be done using style 'classes', which are structure as so:
To activate your classes, you will define the class in the HTML command as so:
Make sure that you have spelled the class name in the command exactly as you have it in the class definition. For example, you have several tables on your page, in one table you want a blue background with white text, in another you want the background to be black with yellow text, and in another you want the background to be white with red text.
You would create your tables as so:
<table>
<table>
<table>
This will produce:
Each <td> command will need to have the class= specification, otherwise other cells in the table will appear as a normal HTML table.
Classes can be created for any HTML formatting element. In Internet Explorer, style can be set to form elements to change the background color and text color of fields and buttons.
Another way to apply style to a single element is to 'embed' the style into the HTML command:
<P style="color:red; font-style:italic; font-weight:bold;">This paragraph contains red text, in italics, and bolded.
Will produce:
This paragraph contains red text, in italics, and bolded.
For a reference on Style Sheet definitions click here.
Copyright © 2004- 2005 S &W Concepts |