Skip to content Skip to sidebar Skip to footer

Override Default CSS For Table

I am making a table on a webpage inside Zetaboards forum software. When I am trying to create alternating background color for each row, the forum's default CSS intervenes. My HT

Solution 1:

Table cells are contained within table rows. When you apply background color to both rows and cells (as is the case with the above example) the cell background color will cover the rows' background color.

Workaround: add this rule to undo the forum's styles applied on table cells:

table.stats td {
    background: transparent none;
}

And apply background color on rows (i.e. no change in your original example):

table.stats tbody tr:nth-child(even) {
    background-color: #333;
}
table.stats tbody tr {
    background-color: #232;
}

Solution 2:

1.)you have to add td after tr in your css

Try this:

 <style>
     table.stats tbody tr td:nth-child(even) { 
      background-color: #333 !important ;
    } 
    table.stats tbody tr td{ 
      background-color: #232 !important ;
    } 
</style>

Post a Comment for "Override Default CSS For Table"