使用 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