Automatic table formatting with css

  • Unknown's avatar

    Dear community,
    I seem to have a rather difficult problem.
    I want to use css to have my tables formatted automaticly.
    I want a table to look exactly as you can see on my blog http://www.howegethealthy.com without having to do all the formatting manually.

    Here the code I tried:
    table.caltable td:nth-child(2) {
    font-style: italic;
    text-align: center;
    }
    table.caltable td:nth-child(3) {
    font-style: italic;
    text-align: center;
    }
    table.caltable tr:nth-last-child(1) {
    font-style: bold;
    font-style: italic;
    }
    table.caltable tr:nth-last-child(2) {
    font-style: bold;
    font-style: italic;
    }
    table.caltable td:nth-child(1) {
    font-style: bold;
    }

    As far as I can say: does not work!

    Help would be gratly apreciated!

    kind regards

    The blog I need help with is: (visible only to logged in users)

  • Unknown's avatar

    Can you try something like this instead?

    .caltable tr:nth-child(even) {background: #fff;}
    .caltable tr:nth-child(odd) {background: #f9f9f9;}
    .caltable td { text-align: center; font-style: italic; }
    .caltable tr td:first-child { text-align: left; font-style: normal; }
    .caltable tbody tr:first-child,
    .caltable tr:nth-last-child(0),
    .caltable tr:nth-last-child(1) { font-weight: bold; }
  • The topic ‘Automatic table formatting with css’ is closed to new replies.