SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    Don't eat yellow snow spaceman's Avatar
    Join Date
    Mar 2001
    Location
    Melbourne, Australia
    Posts
    1,039
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    CSS font-size and <table> tag

    I'm not too clear on the rules of CSS inheritance.

    I want to change the font-size using CSS for all displayed text inside in a large, complex <table>. I know that if I put my class definition in every single <td> inside this table than I will get the desired effect. But if I put the same class definition inside the <table> tag, then it doesn't work - the displayed text size is unaffected.

    So my question is - is there a way to achieve this effect using CSS without having to put my class definition inside every single <td> element? Is this solution cross-browser compatible?

    Thanks for your help.
    Web Design Perth Melbourne .:. Itomic Business Website Solutions
    Drupal Experts .:. Drupalise

  2. #2
    SitePoint Wizard creole's Avatar
    Join Date
    Oct 2000
    Location
    Nashvegas Baby!
    Posts
    7,845
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    spaceman...

    Remember that the TABLE is not "technically" the container for your text, the TD is. Thus, while IE will cascade properly and display TD's in the style given to a TABLE, Netscape will not.

    You might consider having a master style for your TD's and apply it using the normal selector method like os:

    td {some style}

    instead of

    td.class {some style}
    Adobe Certified Coldfusion MX 7 Developer
    Adobe Certified Advanced Coldfusion MX Developer
    My Blog (new) | My Family | My Freelance | My Recipes

  3. #3
    Don't eat yellow snow spaceman's Avatar
    Join Date
    Mar 2001
    Location
    Melbourne, Australia
    Posts
    1,039
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    More good advice. Thanks Creole. Your answer confirms to me that I have to use class in every <td> in order to be sure, to be sure.

    Regarding your suggestion of a 'master' style, let's say I do this:
    <style>
    td

    </style>
    Web Design Perth Melbourne .:. Itomic Business Website Solutions
    Drupal Experts .:. Drupalise

  4. #4
    Don't eat yellow snow spaceman's Avatar
    Join Date
    Mar 2001
    Location
    Melbourne, Australia
    Posts
    1,039
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    More good advice. Thanks Creole. Your answer confirms to me that I have to use class in every <td> in order to be sure, to be sure. Except...

    Regarding your suggestion of a 'master' style - I normally put all my CSS definitions in the <style> tag inside the <head> tag. Is it acceptable to redefine my 'master' <td> tag just before a large complex table containing lots of <td> tags, and then change it back to something else after the closing </table> tag? Is this bad practice and/or not cross-browser compatible - or perhaps it just doesn't work?
    Web Design Perth Melbourne .:. Itomic Business Website Solutions
    Drupal Experts .:. Drupalise

  5. #5
    SitePoint Wizard creole's Avatar
    Join Date
    Oct 2000
    Location
    Nashvegas Baby!
    Posts
    7,845
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I know what you're talking about but it wouldn't work quite the way you are thinking.

    You would have to define the style in each seperate TD tag at that point and that would be defeating the purpose of CSS.

    Keep in mind that it is perfectly acceptable to define colors and alignment in the TD tag using HTML instead of CSS.
    Adobe Certified Coldfusion MX 7 Developer
    Adobe Certified Advanced Coldfusion MX Developer
    My Blog (new) | My Family | My Freelance | My Recipes


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
  •