css3 - Lighten parent's (unknown) background-color in child -
is there way in less or (css3 in general) access parent's background-color
without knowing it?
something like:
.child-class { background-color: lighten(parent-background-color, 30%); }
a less variable obvious approach in case don't know parent's background-color
can dynamically styled.
anybody got in trick box out?
edit: have @ scotts's answer clever solution need.
that cannot done in pure css. reason these types of references lead 'circular' situations. or situations dom has looped on multiple times determine final value. both these situations css avoids.
now, if main goal define 'pallette' of sorts , have colors work together, should css expansion tools "sass" or "less". let define colors , change them , other useful comparison things. have @ tools if want such flexibility. cannot however, direct comparison ask, since reduce css in end.
this can done using javascript, , more using jquery. wont clutter answer javascript/jquery code when isn't need.
Comments
Post a Comment