W3School TIY Editor
W3School 在线教程
改变方向
暗黑模式
运行代码
<!DOCTYPE html> <html> <head> <style> #p1 {background-color:rgb(255,0,0);opacity:0.6;} #p2 {background-color:rgb(0,255,0);opacity:0.6;} #p3 {background-color:rgb(0,0,255);opacity:0.6;} #p4 {background-color:rgb(192,192,192);opacity:0.6;} #p5 {background-color:rgb(255,255,0);opacity:0.6;} #p6 {background-color:rgb(255,0,255);opacity:0.6;} </style> </head> <body> <h1>用 opacity 定义颜色</h1> <p id="p1">红色</p> <p id="p2">绿色</p> <p id="p3">蓝色</p> <p id="p4">灰色</p> <p id="p5">黄色</p> <p id="p6">樱桃色</p> </body> </html>