html - Is same background for two different headings possible ? (RGB keyboard-like effect) -
i'm planning on creating css version of rgb keyboard. make text gradient easy, 'sync' gradient between headings impossible me right now. there way achieve kind of result?
i tried individual gradient animation , blend mode, still can't figure way out.
i used background-clip , achieved beautiful gradient animation individual headings, gradients 'individual', not synced rgb keyboard...
.keyboard { background-image: linear-gradient(to right, #f00, #ff0, #0f0, #0ff, #00f, #f0f, #f00); display: inline-block; } .key { display: inline-block; width: 35px; height: 35px; font-size: 1.5em; text-align: center; padding-top: 5px; margin: 5px; /* important stuff */ background-color: black; color: white; mix-blend-mode: multiply; }
<div class="keyboard"> <div class="key">a</div> <div class="key">b</div> <div class="key">c</div> <div class="key">d</div> <div class="key">e</div> <div class="key">...</div> </div>
when setting color white (#fff
) , background-color black (#000
) on keys , set mix-blend-mode
multiply
background (background-color
) remains black , foreground (color
) gets whatever value background of container becuse:
color c; c x white === c c x black === black
Comments
Post a Comment