Is it possible to dynamically make a transparent background from a solid and transparent color in CSS3? For instance:
<div class="red trans1"> CONTENT </div>
with CSS
.red { background: #FF0000; } .trans1 background: rgba(255,255,255,0.5); }
In this case, the solid color completely covers the transparency. Of course, I mean using different properties ( background , background-color , etc.).
I have 10 solid colors and you want to create 10 levels of transparency for each. If you individually make a transparent color for each color, it needs 100 CSS classes; eg:.
.red1 { .background: rgba(255,0,0,0.1); } .red2 { .background: rgba(255,0,0,0.2); } .red3 { .background: rgba(255,0,0,0.3); } .... .blue1 { .background: rgba(0,0,255,0.1); } .blue2 { .background: rgba(0,0,255,0.2); } .blue3 { .background: rgba(0,0,255,0.3); }
I am looking for a dynamic way to mix solid color and transparent background.