CSS Help - Table formatting (6 posts)

  1. kelemvor
    Posted 3 years ago #


    I'm trying to add a table to my website and NOT have the default CSS stuff apply to it. I can't find a way to do this.

    I decided to try assign a class name to the table and setting specific values for it but that doesn't seem to help.

    The table properties seem to be being overwritten by stuff in a #content flag:

    In my style.css file I have this:

    #content tr td {
    border-top: 1px solid #e7e7e7;
    padding: 6px 24px;

    I tried setting Table class="x" and then setting up things like

    table.x td {
    font-size: small;
    padding: 0px 0px;
    width: 14%;
    height: 80px;
    text-align: left;
    vertical-align: top;

    When the page renders, it's using data from both of the tags but the #content one is overriding the 'x' one and I can't remove the padding. I don't want to change the main style as I don't know how many places that might be being used right now.

    Is there some other way I can do this? Does that make sense?


  2. Andrew Nevins
    Forum moderator
    Posted 3 years ago #

    It sounds as though you need the support of a CSS forum like http://CSSCreator.com/forum

  3. Slobodan Kustrimovic
    Posted 3 years ago #

    #content .x tr td { /* code */ }
  4. kelemvor
    Posted 3 years ago #

    That worked. hmm. Don't know why but it worked. :)


  5. Slobodan Kustrimovic
    Posted 3 years ago #

    You're welcome.

    It works because it's more specific. If you wanna know more about it check this tutorial -> CSS Specificity: Things you should know.

  6. kelemvor
    Posted 3 years ago #

    Sheesh. If it wasn't quitting time I'd read that. I'll bookmark it for next week.


Topic Closed

This topic has been closed to new replies.

About this Topic