Lighten parent's (unknown) background-color in child

前端 未结 3 1309
终归单人心
终归单人心 2020-12-04 03:15

Is there a way in less or (css3 in general) to access parent\'s background-color without knowing it?

Something like:

.child-class {
             


        
3条回答
  •  独厮守ぢ
    2020-12-04 03:59

    It's actually possible with the new backdrop-filter property but the browser support isn't very good at the moment.

    .child {
      backdrop-filter: brightness(1.5);
    }
    

    For now, I would still stick with a white/black alpha background color, which works well for grayscale backgrounds.

提交回复
热议问题