使用 CSS 定义红-绿-蓝-透明度 (RGBA) 颜色模型中的颜色
使用 CSS rgb() 函数使用 RGB 模型定义颜色。
使用 CSS rgba() 函数设置具有透明度的 RGB 颜色。
示例
您可以尝试运行以下代码来使用 rgba() 函数设置颜色
<!DOCTYPE html>
<html>
<head>
<style>
h1 {
background-color:hsl(0,100%,50%);
}
h2 {
background-color:rgb(0,0,255);
color: rgb(255,255,255);
}
p {
background-color:rgba(255,0,0,0.9);
}
</style>
</head>
<body>
<h1>Red Background</h1>
<h2>Blue Background</h2>
<p>This is demo text!</p>
</body>
</html>
广告
数据结构
网络
关系数据库管理系统 (RDBMS)
操作系统
Java
iOS
HTML
CSS
Android
Python
C 编程
C++
C#
MongoDB
MySQL
Javascript
PHP