Filippo oretti
Filippo oretti

Reputation: 49843

CSS/Javascript dynamic gradient or shadow

I'm using these rules:

.log-widget-alexa{ background: #001C48;}
.log-widget-altervista{ background: #FFE852;}
.log-widget-amazon{ background: #000000;}
.log-widget-aol{ background: #0060A3;}
etc ..

I would like to use only 1 more class to add an inset darken shadow or gradient color to emboss the widgets with same darken background.

Is it possible with some CSS/JavaScript/jQuery tricks?

I mean if i have background:#666; I would like to add a simple gradient/shadow in #555 for example (little beat darken from the starter background color in this case = #666)

I would like to set some css trick rather than manually with box-shadow or background-image gradient :/ because i have thousands of these rules in my CSS.

Upvotes: 0

Views: 302

Answers (1)

Christoph
Christoph

Reputation: 51241

It's not possible with pure CSS. You need Javascript for that. Select all your elements, get the background color with .css(), compute the seconds color, and then with .css() apply the gradient accordingly.

Upvotes: 1

Related Questions