SitePoint Sponsor

User Tag List

Results 1 to 9 of 9
  1. #1
    I want my 4th arrow! garlinto's Avatar
    Join Date
    Jun 2002
    Location
    Riding the electron wave
    Posts
    372
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Arrow Only one div id declaration per page....

    After reading some of the threads here lately, not only have I been able to correct a great many of my CSS issues, but I have learned much in the process...

    One thing I read in a recent thread is that you cannot have more than one div id per page - no repetitions. This is difficult for me to assimilate. For example, on my page (which many of you have helped me with - thanks!), I have some tables that are one TR in height and use only one TD as well, but are filled with up to 12 div's, some that have id #cell, and others that have id #cell_pkg (which, incidenly, did not parse in the validator - doesn't like the "_"?). I use those same id's because the are all positioned relatively and I achieve the layout I want. Also, the validator noticed my repeated use of the same div id's.

    However, to be W3C compliant, do I need to specify a unique id to every div I put on my page? Sounds to me like I will have an incredibly huge style sheet!
    Ducharme's Axiom: "If you view your problem closely
    enough, you will recognize yourself as part of the problem."


  2. #2
    ********* Streaker Lister14's Avatar
    Join Date
    Jun 2002
    Location
    C:\Documents and Settings\Desktop\Recycle Bin
    Posts
    677
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    well, it isn't written that you can't have the same div class all over the place...


    '#div' is different from '.div'

    i tend to use #div as a big container (e.g. main/navigation/...)

    and .div for stuff that will be found more often within (e.g. link/paragraph/...)
    roy.lu
    C:\DOS... C:\DOS\RUN... RUN\DOS\RUN...!

  3. #3
    gingham dress, army boots... silver trophy redux's Avatar
    Join Date
    Apr 2002
    Location
    Salford / Manchester / UK
    Posts
    4,838
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    as lister said: you use ID for unique elements (e.g. the header, the footer, the main body of the page), and classes to define styles etc for recurring/multiple elements...
    re·dux (adj.): brought back; returned. used postpositively
    [latin : re-, re- + dux, leader; see duke.]
    WaSP Accessibility Task Force Member
    splintered.co.uk | photographia.co.uk | redux.deviantart.com

  4. #4
    SitePoint Wizard Ian Glass's Avatar
    Join Date
    Oct 2001
    Location
    Beyond yonder
    Posts
    2,384
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You can even space separate your classes like so:
    Code:
    class="right small green"
    And the object will take on each of those classes. In case of a conflict between the classes, the furthest right wins, absent "!important", of course. :-)

    ~~Ian

  5. #5
    ☆★☆★ silver trophy vgarcia's Avatar
    Join Date
    Jan 2002
    Location
    in transition
    Posts
    21,235
    Mentioned
    1 Post(s)
    Tagged
    1 Thread(s)
    Originally posted by Ian Glass
    You can even space separate your classes like so:
    Code:
    class="right small green"
    And the object will take on each of those classes. In case of a conflict between the classes, the furthest right wins, absent "!important", of course. :-)

    ~~Ian
    Wow I didn't know that! Pretty cool, as I was trying to figure something like this out yesterday and just wound up writing a new CSS class; but it's a great reference for the future!

  6. #6
    I want my 4th arrow! garlinto's Avatar
    Join Date
    Jun 2002
    Location
    Riding the electron wave
    Posts
    372
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    So then...

    Thanks for the replies...

    So to be more compliant, I can use #div for the containers, and .class for the reoccuring content-handling stuff. Ok, think I have it now.

    So then...

    If I recode my div's so that the repetitive #cell and #cell_pkg id's are changed to .cell and .cell_pkg, I will validate? Also, is the underscore (_) a valid css character? Should I have .cellpkg instead of .cell_pkg?
    Ducharme's Axiom: "If you view your problem closely
    enough, you will recognize yourself as part of the problem."


  7. #7
    I want my 4th arrow! garlinto's Avatar
    Join Date
    Jun 2002
    Location
    Riding the electron wave
    Posts
    372
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Talking Yaaaaaahhhhh!

    W3C CSS Validator Results for http://www.tandrtrailer.com/cgi-bin/css/hitchorder.css

    Congratulations!

    This Document Validates as CSS!
    Thanks guys...
    Your input helped a lot!

    It's good to be compliant.
    Ducharme's Axiom: "If you view your problem closely
    enough, you will recognize yourself as part of the problem."


  8. #8
    SitePoint Enthusiast
    Join Date
    Aug 2002
    Location
    Australia
    Posts
    56
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally posted by Ian Glass
    [B]You can even space separate your classes like so:
    Code:
    class="right small green"
    And the object will take on each of those classes.
    Where is this in the W3C recommendations? I've looked for it in the CSS2 rec. but couldn't find it. Thanks!

  9. #9
    Robert Wellock silver trophybronze trophy xhtmlcoder's Avatar
    Join Date
    Apr 2002
    Location
    A Maze of Twisty Little Passages
    Posts
    6,316
    Mentioned
    60 Post(s)
    Tagged
    0 Thread(s)
    I also cannot remember ever coming across 'Space separated classes' in that context if you wrote something like:
    Code:
    #main .center img {
    width : 88px; height : 31px;}
    within an extarnal CSS file then I'd have been more happy if you were referring to CSS and spaces...


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
  •