If this is your first visit, please click the Sign Up now button to begin the process of creating your account so you can begin posting on our forums! The Sign Up process will only take up about a minute of two of your time.

Results 1 to 4 of 4

Thread: CSS help plzz

  1. #1
    Junior Member
    Join Date
    Aug 2004
    Member #
    Hey Friends iam a total novice in css. Does any 1 explain in detail the difference between the class selectors and the ID Selectors and other types of classes that are there in css and when to use class selectors and when to use ID selectors in detail plzz. Iam an amateur web Designien recently started css. plzzz help me in this regard plzz. Thanks in advance.
    sincerely urs


  3. #2
    Senior Member nsr81's Avatar
    Join Date
    Oct 2002
    Member #
    15 times

    No CSS guru, but I'll try to explain the difference.

    Class Selectors:

    Class selectors are indicated by a "." (period) preceeding the selector name. two different forms you may see them in:
    .class { ... }
    tag.class { ... }
    The first one is used when you want to apply that class to any HTML element(tag). Second one restricts the class to only one element.

    ID Selectors:

    indicated by hash-mark or number sign(#) preceeding the name. They can also be define for any tag or just for one.

    The main difference between class and id tags is that IDs within an HTML structure need to be unique in order to pass validation. Therefore, the ID selector is suited best for unique elements of your page. for example, you have one "header", one "body", and one "footer", use ID selectors for them.

    Classes on the other hand can be applied to anything and everything regardless of the uniqeness. same class can be assigned to a an anchor tag as well as a paragraph and table cell.

    That's what my understanding is, corrections are welcomed.
    There and Back Again :Ogre:

  4. #3
    Senior Member
    Join Date
    Feb 2005
    Member #
    the code for a class and an id is as follows:
    HTML Code:
    <div class='the_class'></div>
    HTML Code:
    <div id="the_id"></div>
    you could use a class and an id to make a cascadeing effect like so:
    #id {font-weight:bold;}
    .class {color:#ff0000;}
    DIV {font-family:ariel;}
    HTML Code:
    <div>test 1</div>
    <div id="id" class="class">test 2</siv>
    <div class="class">test 3</div>
    this allows for versatility
    Thee Pyro Wolf

  5. #4
    Senior Member Rince's Avatar
    Join Date
    Nov 2004
    Member #
    the purpose of a selector is to idtenify which element or elements of html that style definition should be applied to. There are many types of slectors. They can be used individually or combined to specify as exactly what elements the style applys to or does not apply to.

    A full list of the various selectors is available here

Remove Ads

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
All times are GMT -6. The time now is 04:56 AM.
Powered by vBulletin® Version 4.2.3
Copyright © 2021 vBulletin Solutions, Inc. All rights reserved.
vBulletin Skin By: