shadowline
Tag Style << ID & Class >> Font Style
ID and CLASS are commands used to give a "name" to a certain CSS format. These are used when you want to apply a certain formatting style at specified areas. When selecting names for these areas, stay away from using the _ underscore _ character. Older netscape and opera browsers may have a problem reading them.


ID Elements

The ID is used to apply a general format style to a single instance or HTML tag. It places a NAME on a certain style.

Using an ID or CLASS element requires the code to be specified in the HEAD area (embeded) or on an external css page. The "using" code is in an HTML tag in the BODY area (inline).

HEAD area <style type="text/css">
<!-- #abc {color: #ff0000;} -->
</style>
BODY area <p id="abc"> First </p>
<p> Second </p>
First
Second

The # is used to specify an ID element. It says "when this ID is found in a tag, use this format".

The ID can only be used by one element. This limits the usage on this type of formatting, but at times, that is all you need. For a more versatile formatting, CLASS is used.



Class Elements

CLASS elements are very similar to ID elements. ID elements are used for a single instance or area. The CLASS elements are used for many instances or a larger area.

Using an ID or CLASS element requires the code to be specified in the HEAD area (embeded) or on an external css page. The "using" code is in an HTML tag in the BODY area (inline).

HEAD area <style type="text/css">
<!-- .abc {color: #ff0000;} -->
</style>
BODY area <p class="abc"> First </p>
<p> Second </p>
<h3 class="abc"> Third </h3>
First
Second
Third

Differences between ID and CLASS ?
  1. The . is used in place of the #
  2. class is used in place of id
  3. ID is for single instances or tags.
  4. CLASS is used for multiple instances or tags.
Tag Style << ID & Class >> Font Style
shadow

Advertise in the banner along the top, Click here!

Valid XHTML 1.0 Transitional Valid CSS! Text Link Ads
shadow
shadow