SitePoint Sponsor

User Tag List

Results 1 to 6 of 6

Thread: class

  1. #1
    SitePoint Enthusiast
    Join Date
    Sep 2003
    Location
    rotterdam
    Posts
    91
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    class

    I am experimenting with css.
    I would like to know if it is possible to give a specific cell more than one class.

    thanks

  2. #2
    Word Painter silver trophy Shyflower's Avatar
    Join Date
    Oct 2003
    Location
    Winona, MN USA
    Posts
    10,054
    Mentioned
    142 Post(s)
    Tagged
    2 Thread(s)
    Quote Originally Posted by Rodney
    I am experimenting with css.
    I would like to know if it is possible to give a specific cell more than one class.

    thanks
    I don't think so. Read more about grouping in the CSS1 specification.
    Linda Jenkinson
    "Say what you mean. Mean what you say. But don't say it mean." ~Unknown

  3. #3
    ☆★☆★ silver trophy vgarcia's Avatar
    Join Date
    Jan 2002
    Location
    in transition
    Posts
    21,236
    Mentioned
    1 Post(s)
    Tagged
    1 Thread(s)
    Quote Originally Posted by Rodney
    I am experimenting with css.
    I would like to know if it is possible to give a specific cell more than one class.

    thanks
    Yes you can! Just put a space between your class names. Here's an example:

    CSS:
    Code:
    .sky {
      color: blue;
      background: white;
    }
    .big {
      font-size: 50px;
      /*yes it's unrealistic, but who cares? */
    }
    HTML:
    HTML Code:
    <td class="sky big">stuff</td>

  4. #4
    Word Painter silver trophy Shyflower's Avatar
    Join Date
    Oct 2003
    Location
    Winona, MN USA
    Posts
    10,054
    Mentioned
    142 Post(s)
    Tagged
    2 Thread(s)
    Quote Originally Posted by vgarcia
    Yes you can! Just put a space between your class names. Here's an example:

    CSS:
    Code:
    .sky {
      color: blue;
      background: white;
    }
    .big {
      font-size: 50px;
      /*yes it's unrealistic, but who cares? */
    }
    HTML:
    HTML Code:
    <td class="sky big">stuff</td>
    You know, I thought I had seen that somewhere, but when I looked at the specifications (and I looked through them all!) I couldn't find it. Where is it?
    Linda Jenkinson
    "Say what you mean. Mean what you say. But don't say it mean." ~Unknown

  5. #5
    SitePoint Zealot midnight9's Avatar
    Join Date
    Jan 2003
    Location
    2nd seat, 3 rows back
    Posts
    118
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Anyone know the limit as to how many classes you can use? I've been using up to 3 classes in any given div for quite some time and it works fine. But I heard 3 was the limit, but I don't know if that's true or not.

    Regardless, I highly recommend using several classes per div whenever possible, especially for font specifications.

    For example, try this:

    Code:
    .f1 {font-size: 9px;}
    .f2 {font-size: 10px;}
    .f3 {font-size: 11px;}
    .f4 {font-size: 12px;}
    .f5 {font-size: 13px;}
    
    .t1 {font-family: Arial;}
    .t2 {font-family: Georgia;}
    .t3 {font-family: Palatino;}
    .t4 {font-family: Tahoma;}
    .t5 {font-family: Trebuchet;}
    .t6 {font-family: Verdana;}
    
    .c1 {color: #000;}
    .c2 {color: #fff;}
    .c3 {color: #c00;}
    .c4 {color: #7f7f7f;}
    ...and then you can do this

    HTML Code:
    <div class="f3 t1 c1">Hello</div>
    Saves a lot of unnecessary duplication in classes & IDs if you're changing font styles often.

  6. #6
    ☆★☆★ silver trophy vgarcia's Avatar
    Join Date
    Jan 2002
    Location
    in transition
    Posts
    21,236
    Mentioned
    1 Post(s)
    Tagged
    1 Thread(s)
    Quote Originally Posted by midnight9
    Anyone know the limit as to how many classes you can use? I've been using up to 3 classes in any given div for quite some time and it works fine. But I heard 3 was the limit, but I don't know if that's true or not.
    I don't think there is a limit. I've done 4 classes and it's been fine. I rarely ever need more than 2 at once though.


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
  •