 |
| An Introduction to CSS |
pages (2): 1 [2] |
|
 |
 |

Section 3: IDs
IDs work in similar ways to classes, except that they can only be used once (whereas classes can be used multiple times). For this reason, you should stick with classes for most formatting, and only use IDs for unique properties. Another reason they exist is to allow you to incorporate Style Sheet models into JavaScript or DHTML. If you want to give IDs a whirl, here's how to use them:
The CSS:
|
#bigfont{ font-family:Arial, Helvetica, sans-serif; font-size:40px; }
| The HTML:
|
<font id="bigfont">This is big text.</font>
|
The above example is valid coding, while this next example is not.
The CSS:
|
#bigfont{ font-family:Arial, Helvetica, sans-serif; font-size:40px; }
| The HTML:
|
<td id="bigfont"> <font id="bigfont">This is big text inside a <td> with the
same class applied.</font> </td>
|
Section 4:
Linking to External CSS Finally we get to the end. The last thing
to know is how to actually use the stylesheet. Once you compile together all of
your CSS into one file, save it with a .css extension.
Now go into your HTML document and add this line within your <head> tags:
<link rel="stylesheet" type="text/css" href="file.css" media="all" title="Your Title"/>
|
Replace 'yourfile.css' with the path to the CSS file
and 'Your Title' with whatever you want to call your stylesheet.
And thats it! For more detail on attributes and settings, try
accessing a reference site such as
W3Schools. Enjoy your newfound skills!
- Tutorial written by Gus Mayo
|  |  |  |  |
|
 |
Forum Threads
|
 |
 |

Deactivate Account Author: jerinian Posted: Oct 02nd, 11:16am Activity: 1 replies, 890 views
|  | changes.... Author: supertackyman Posted: Sep 12th, 2:56am Activity: 2 replies, 1055 views
|  |
| | |