CSS rgba()関数
例
不透明度(RGBA)でさまざまなRGBカラーを定義します。
#p1 {background-color:rgba(255,0,0,0.3);} /* red with opacity*/
#p2 {background-color:rgba(0,255,0,0.3);} /* green with opacity */
#p3 {background-color:rgba(0,0,255,0.3);} /* blue with opacity */
定義と使用法
rgba()関数は、赤-緑-青-アルファ(RGBA)モデルを使用して色を定義します。
RGBAカラー値は、アルファチャネルを使用したRGBカラー値の拡張です。これは色の不透明度を指定します。
バージョン: | CSS3 |
---|
ブラウザのサポート
表の数字は、この機能を完全にサポートする最初のブラウザバージョンを示しています。
Function | |||||
---|---|---|---|---|---|
rgba() | 1.0 | 9.0 | 3.0 | 3.1 | 10.0 |
CSS構文
rgba(red, green, blue, alpha)
Value | Description |
---|---|
red | Defines the intensity of red as an integer between 0 and 255, or as a percentage value between 0% and 100% |
green | Defines the intensity of green as an integer between 0 and 255, or as a percentage value between 0% and 100% |
blue | Defines the intensity of blue as an integer between 0 and 255, or as a percentage value between 0% and 100% |
alpha | Defines the opacity as a number between 0.0 (fully transparent) and 1.0 (fully opaque) |