SitePoint Sponsor

User Tag List

Results 1 to 4 of 4

Thread: class or id

  1. #1
    SitePoint Member crazyfool's Avatar
    Join Date
    Jan 2004
    Location
    earth
    Posts
    22
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    class or id

    is it good practice to using the id attribute in the table tag?

    ran my page through CSE html validator pro and it didn't think so....

    later,

    mr T

  2. #2
    The CSS Clinic is open silver trophybronze trophy
    Paul O'B's Avatar
    Join Date
    Jan 2003
    Location
    Hampshire UK
    Posts
    39,787
    Mentioned
    158 Post(s)
    Tagged
    3 Thread(s)
    Hi,

    You can use the id tag wherever you want but only once per page. However it's best to use it to make structural sense and make sure it is unique on the page.

    You cannot use the same id more than once on a page as it must be a unique reference to that item although browsers will probably still render ok it's not according to the specs and should be avoided.

    Most uses for id's would be to show the main structure of the page for items that don't need to be repeated.

    e.g.
    <div id="mainheading"></div>
    <div id="mainmenu"></div>
    <div id="maincontent"></div>

    etc.......

    You could use a class for subcontent beacuse you may want to use it over and over again.

    There is no problem putting an id into a table but you can only put it into one table as mentioned above.

    Hope that helps.

    Paul

  3. #3
    SitePoint Member crazyfool's Avatar
    Join Date
    Jan 2004
    Location
    earth
    Posts
    22
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Interesting. Thanks Paul.

  4. #4
    gimme the uuuuuuuuuuu duuudie's Avatar
    Join Date
    Feb 2004
    Location
    Switzerland
    Posts
    2,253
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I had a similar question a few days ago. This thread might help you:

    http://www.sitepoint.com/forums/showthread.php?t=155430



Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •