首页
CSS
CSS 不透明度
试用:不透明度与 RGBA 值
运行 ❯
获取您
自己的
网站
×
更改方向
保存代码
更改主题,深色/浅色
前往 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>