RGB Colors in CSS
RGB colors can be specified in style rules by any of the methods listed in Table D-2.
Table D-2. Methods for specifying RGB colors
|
Method |
Syntax |
Example |
|---|---|---|
|
Six-digit hexadecimal. |
|
|
|
Three-digit RGB shorthand. This method may be used when each RGB value is double digits. |
(interpreted as # |
(interpreted as |
|
Three decimal values. |
|
|
|
Three percentage values (calculated as a percentage of 255). |
|
|
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access