-
Notifications
You must be signed in to change notification settings - Fork 22.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adds pages for rgb() and rgba() (#2929)
- Loading branch information
1 parent
ea3293e
commit 7243b80
Showing
3 changed files
with
102 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
--- | ||
title: rgb() | ||
slug: Web/CSS/color_value/rgb() | ||
tags: | ||
- CSS | ||
- CSS Data Type | ||
- Data Type | ||
- Reference | ||
- Web | ||
- color | ||
- rgb | ||
--- | ||
<div>{{CSSRef}}</div> | ||
|
||
<p>The <strong><code>rgb()</code></strong> functional notation expresses a color according to its red, green, and blue components. An optional alpha component represents the color's transparency.</p> | ||
|
||
<div class="notecard note"> | ||
<h4>Note</h4> | ||
<p>CSS Colors Level 4 made some changes to <code>rgb()</code>. In browsers that support the standard {{cssxref("color_value/rgba()","rgba()")}} is an alias for <code>rgb()</code>, they accept the same parameters and behave the same way.</p> | ||
|
||
<p>The Level 4 specification also allows for space-separated in addition to comma-separated values.</p> | ||
</div> | ||
|
||
<h2 id="Syntax">Syntax</h2> | ||
|
||
<pre class="brush: css">rgb(255,255,255) /* white */ | ||
rgb(255,255,255,.5) /* white with 50% opacity */ | ||
rgb(255 255 255); /* CSS Colors 4 space-separated values */ | ||
</pre> | ||
|
||
<h3 id="Values">Values</h3> | ||
|
||
<dl> | ||
<dt>Functional notation: <code>rgb[a](R, G, B[, A])</code></dt> | ||
<dd><code>R</code> (red), <code>G</code> (green), and <code>B</code> (blue) can be either {{cssxref("<number>")}}s or {{cssxref("<percentage>")}}s, where the number <code>255</code> corresponds to <code>100%</code>. <code>A</code> (alpha) can be a {{cssxref("<number>")}} between <code>0</code> and <code>1</code>, or a {{cssxref("<percentage>")}}, where the number <code>1</code> corresponds to <code>100%</code> (full opacity).</dd> | ||
<dt>Functional notation: <code>rgb[a](R G B[ / A])</code></dt> | ||
<dd>CSS Colors Level 4 adds support for space-separated values in the functional notation.</dd> | ||
</dl> | ||
|
||
<h2 id="Browser_compatibility">Browser compatibility</h2> | ||
|
||
<p>{{Compat("css.types.color.rgb_functional_notation")}}</p> | ||
|
||
<h3>Space-separated values</h3> | ||
|
||
<p>{{Compat("css.types.color.space_separated_functional_notation")}}</p> | ||
|
||
<h3>Accepts alpha value</h3> | ||
|
||
<p>{{Compat("css.types.color.rgb_function_accepts_alpha")}}</p> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
--- | ||
title: rgba() | ||
slug: Web/CSS/color_value/rgba() | ||
tags: | ||
- CSS | ||
- CSS Data Type | ||
- Data Type | ||
- Reference | ||
- Web | ||
- color | ||
- rgba | ||
--- | ||
<div>{{CSSRef}}</div> | ||
|
||
<p>The <strong><code>rgba()</code></strong> functional notation expresses a color according to its red, green, and blue components. An optional alpha component represents the color's transparency.</p> | ||
|
||
<div class="notecard note"> | ||
<h4>Note</h4> | ||
<p>CSS Colors Level 4 allows for space-separated in addition to comma-separated values.</p> | ||
</div> | ||
|
||
<h2 id="Syntax">Syntax</h2> | ||
|
||
<pre class="brush: css">rgba(255,255,255,.5) /* white with 50% opacity */ | ||
rgba(255 255 255,.5); /* CSS Colors 4 space-separated values */ | ||
</pre> | ||
|
||
<h3 id="Values">Values</h3> | ||
|
||
<dl> | ||
<dt>Functional notation: <code>rgb[a](R, G, B[, A])</code></dt> | ||
<dd><code>R</code> (red), <code>G</code> (green), and <code>B</code> (blue) can be either {{cssxref("<number>")}}s or {{cssxref("<percentage>")}}s, where the number <code>255</code> corresponds to <code>100%</code>. <code>A</code> (alpha) can be a {{cssxref("<number>")}} between <code>0</code> and <code>1</code>, or a {{cssxref("<percentage>")}}, where the number <code>1</code> corresponds to <code>100%</code> (full opacity).</dd> | ||
<dt>Functional notation: <code>rgb[a](R G B[ / A])</code></dt> | ||
<dd>CSS Colors Level 4 adds support for space-separated values in the functional notation.</dd> | ||
</dl> | ||
|
||
<h2 id="Browser_compatibility">Browser compatibility</h2> | ||
|
||
<p>{{Compat("css.types.color.alpha")}}</p> | ||
|
||
<h3>Space-separated values</h3> | ||
|
||
<p>{{Compat("css.types.color.space_separated_functional_notation")}}</p> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters