SitePoint Sponsor

User Tag List

Results 1 to 6 of 6
  1. #1
    SitePoint Enthusiast
    Join Date
    Mar 2002
    Posts
    64
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    css style not working in table

    OK, so I'm a noob when it comes to CSS - excuse the fact that I may be missing the obvious.

    I have a page, attached to it is a style sheet with font settings etc. Works nicely.

    I then pull in various other pages using include and they work fine, keeping the same css styles etc.

    However, I then have one page, which includes a small standard table. The text within this table is showing in a font which I have not specified. IE, it's not automatically picking up my overall css styles.

    Any idea why this might be?

    Thanks.

  2. #2
    The CSS Clinic is open silver trophybronze trophy
    Paul O'B's Avatar
    Join Date
    Jan 2003
    Location
    Hampshire UK
    Posts
    40,556
    Mentioned
    183 Post(s)
    Tagged
    6 Thread(s)
    If you are working in quirks mode then the font doesn't get inherited into the table. You'll have to style table {} specifically.

    See here for more infor:

    http://www.ericmeyeroncss.com/bonus/render-mode.html

    Paul

  3. #3
    Also available in Large Si's Avatar
    Join Date
    Sep 2002
    Location
    Walsall, UK
    Posts
    1,911
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I normally include the td element in my body declaration in my CSS files:
    Code:
    body, td {
    font-size: 1em;
    // etc...
    }
    It seems to sort out any IE inheritance problems.
    Si
    Are you a Photoshop Jedi Master? Prove it!

    Is funky house your bag? You'll love this!

    Voice
    , eyes, ears, body and hands.


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

    I normally include the td element in my body declaration in my CSS files:
    Yes thats fine but theres is something to watch though. If you declared anything other than 1.0em then the value would compound. If you set .08em then the table font-size would become 80% of the body and perhaps not what was expected.

    1.0em is fine becaue everything remains the same (and I'm sure you knew this anyway but thought it worth pointing out for others )

    Paul

  5. #5
    SitePoint Enthusiast
    Join Date
    Mar 2002
    Posts
    64
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I just changed the DOCTYPE to html 4.1 transitional and it works fine now.... is that ok to do?

  6. #6
    The CSS Clinic is open silver trophybronze trophy
    Paul O'B's Avatar
    Join Date
    Jan 2003
    Location
    Hampshire UK
    Posts
    40,556
    Mentioned
    183 Post(s)
    Tagged
    6 Thread(s)
    Yes as long as you have included the uri (address part) then you will be in standards modeand the inherritance works correctly.

    Paul

    Edit:


    I should mention that that will fix it for ie6 only as ie5 and 5.5. will still be as before and will need the table font-size applied to the table element also.


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
  •