CSS - can I get the current "value" and "add" to it?

In my css I have a table with a zebra stripe. for example, white and blue.

Suppose I have three columns ... what I would like to do is keep the zebra strip, and inside css (without javascript) add shading / make the blue darker for each column.

Is it possible? Something like getting the "current" background color #AABBCC and then adding # 000011 to the current color to give me #AABBDD ...

I don’t know if this is possible, so it’s just interesting. I'm just lazy as I don't want to redefine the zebra strip for each group of columns and columns that I may have.

thank

+5
source share
2 answers

, CSS, - CSS ( Javascript).

, , , LESS, , . , , Javascript, .

+2

-, CSS, . "css-" , : scss, less, stylus .. , , "" CSS.

:

stripe( color )
    &
        background color
    &:nth-child(odd)
        background color + #000011

td.foo
    stripe( teal )

...

td.foo {
  background: #008080;
}
td.foo:nth-child(odd) {
  background: #008091;
}
+2

All Articles