SitePoint Sponsor

User Tag List

Results 1 to 6 of 6
  1. #1
    SitePoint Zealot lord's Avatar
    Join Date
    Nov 2003
    Location
    sLOVEnia
    Posts
    117
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    2 classes for td?

    heya

    I have a table where I use CSS class for a table, tr, td

    I have one general css where I set font, border, etc for a td.
    And now I want to have on each page in my <head> small css code to define td width.

    I mada a class (.td {width:10%}) and include it in td, but didn't work. (keep in mind, that I already have a class defined for td from my general css)

    Then I change second class to id and it works.
    (<td class="tdh_l" id="tr1" ....)

    My question is: why can't I use 2 classes for td. I would assume that second class will just add width spec. for td.
    Or is there a restriction of 1 class per element.

    maxx

  2. #2
    Drupaler bronze trophy greg.harvey's Avatar
    Join Date
    Jul 2002
    Location
    London, UK
    Posts
    3,258
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Yes you can. If this needs to be applied to all cells on the page, lose the dot before TD in your CSS.

    G

  3. #3
    SitePoint Zealot lord's Avatar
    Join Date
    Nov 2003
    Location
    sLOVEnia
    Posts
    117
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by greg.harvey
    Yes you can. If this needs to be applied to all cells on the page, lose the dot before TD in your CSS.

    G
    not to all, each cell have different width value.

  4. #4
    Drupaler bronze trophy greg.harvey's Avatar
    Join Date
    Jul 2002
    Location
    London, UK
    Posts
    3,258
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Ok. Have a look at this:

    http://dbaron.org/css/test/twoclass


  5. #5
    The CSS Clinic is open silver trophybronze trophy
    Paul O'B's Avatar
    Join Date
    Jan 2003
    Location
    Hampshire UK
    Posts
    40,535
    Mentioned
    182 Post(s)
    Tagged
    6 Thread(s)
    Hi,

    Just in case you can't see it in Gregs Link you just add the extra classes to the class statement with a space between each class.
    Code:
    <div class="big yellow bluebg">
    Where big is a class and yellow is another class and blubg is another class.

    Paul

  6. #6
    SitePoint Zealot lord's Avatar
    Join Date
    Nov 2003
    Location
    sLOVEnia
    Posts
    117
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    thanx for help

    I never think of using multiple classes that way
    I tried with class="X" class="Y" and this is wrong.

    regards
    maxx


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
  •