rgba() CSS 函式用法


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

更新於: 2020-06-25

304 次瀏覽

快速開始你的 職業生涯

獲得認證完成課程

開始
廣告
© . All rights reserved.