7

The Blueprint CSS framework makes all table rows of alternating colors by default. How to disable this behaviour for one table?

I tried to use Chrome Developer Tools to see all the styles Chrome uses for a defined table, but did not find the style which would set the colors for rows. I also searched the Internet and did not find a solution. It's like magic...

Anyone can help me out?

Brian Tompsett - 汤莱恩
  • 5,753
  • 72
  • 57
  • 129
Anvar
  • 73
  • 1
  • 3

4 Answers4

16

You need a more specific selector to override... BP is pretty general though so that shouldnt be an issue for example:

table.no-zebra tbody tr:nth-child(even) td,
table.no-zebra tbody tr.even td {
  background: transparent;
}

you can replace transparent with whatever color to make all rows a solid color.

prodigitalson
  • 60,050
  • 10
  • 100
  • 114
  • Thanks! This answers my question accurately - to disable the styling for one specific table. – Anvar Dec 22 '10 at 19:34
3

I would just do override in my own css file

tbody tr:nth-child(even) td, tbody tr.even td {background:none;}

1

This is what I put into the top of my CSS file to disable Blueprint's even table rows background color.

table tr:nth-child(even) td {
  background: transparent;
}
sivabudh
  • 31,807
  • 63
  • 162
  • 228
0

Possibly search for and remove (From screen.css)

tbody tr:nth-child(even) td, tbody tr.even td {background:#e5ecf9;}
Steve Adams
  • 2,812
  • 22
  • 29
  • That would turn off striping of all tables not just one or one's of a particular class. – prodigitalson Dec 22 '10 at 19:12
  • 4
    Don't change blueprint, just override it. It's a bad idea to change the library -- if you load a new version of the library, you won't remember which one you removed, etc. If you override the CSS rules, when you get a new copy of the library, your overrides still function. If you want to generically remove the zebra strips from all tables, you can override the rule by adding a class or ID to your tag, and create a rule for table under that class or ID. – OverClocked Jan 25 '11 at 14:32