使用 CSS 使用红绿蓝 (RGB) 模型定义颜色

cssweb developmentfront end technology更新于 2024/10/17 15:40:17

使用 CSS rgb() 函数使用 RGB 模型定义颜色。您可以尝试运行以下代码,使用红绿蓝 (RGB) 模型设置颜色

示例

<!DOCTYPE html>
<html>
   <head>
      <style>
         h1 {
            background-color:hsl(0,100%,50%);
         }
         h2 {
            background-color:hsl(192,89%,48%);
         }
         p {
            background-color:rgb(0,0,255);
            color: rgb(255,255,255);
         }
      </style>
   </head>
   <body>
      <h1>Red Background</h1>
      <h2>Blue Background</h2>
      <p>This is demo text!</p>
   </body>
</html>

相关文章


有用资源