CSS hsl()関数
例
さまざまなHSL色を定義します。
#p1 {background-color:hsl(120,100%,50%);} /* green */
#p2 {background-color:hsl(120,100%,75%);} /* light green */
#p3 {background-color:hsl(120,100%,25%);} /* dark green */
#p4 {background-color:hsl(120,60%,70%);} /* pastel green */
定義と使用法
hsl()関数は、色相-彩度-明度モデル(HSL)を使用して色を定義します。
HSLは、色相、彩度、明度を表し、色の円筒座標表現を表します。
バージョン: | CSS3 |
---|
ブラウザのサポート
表の数字は、この機能を完全にサポートする最初のブラウザバージョンを示しています。
Function | |||||
---|---|---|---|---|---|
hsl() | 1.0 | 9.0 | 1.0 | 3.1 | 9.5 |
CSS構文
hsl(hue, saturation, lightness)
Value | Description |
---|---|
hue | Defines a degree on the color wheel (from 0 to 360) - 0 (or 360) is red, 120 is green, 240 is blue |
saturation | Defines the saturation; 0% is a shade of gray and 100% is the full color (full saturation) |
lightness | Defines the lightness; 0% is black, 50% is normal, and 100% is white |