Home
CSS
CSS Opacity
Tryit: Opacity vs RGBA values
Run ❯
Get your
own
website
Result Size:
625 x 534
×
Change Orientation
Save Code
Change Theme, Dark/Light
Go to Spaces
<!DOCTYPE html> <html> <head> <style> div { background: rgb(4, 170, 109); padding: 10px; } div.first { background: rgba(4, 170, 109, 0.1); } div.second { background: rgba(4, 170, 109, 0.3); } div.third { background: rgba(4, 170, 109, 0.6); } </style> </head> <body> <h1>Transparent Box</h1> <p>With opacity:</p> <div style="opacity:0.1;"><p>10% opacity</p></div> <div style="opacity:0.3;"><p>30% opacity</p></div> <div style="opacity:0.6;"><p>60% opacity</p></div> <div><p>opacity 1</p></div> <p>With RGBA color values:</p> <div class="first"><p>10% opacity</p></div> <div class="second"><p>30% opacity</p></div> <div class="third"><p>60% opacity</p></div> <div><p>default</p></div> <p>Notice how the text gets transparent as well as the background color when using the opacity property.</p> </body> </html>