Hex Code
Hex is short for hexadecimal, which refers to a base-16 numbering system used to represent color values.
Basic Structure
A hex code starts with a # followed by six hexadecimal characters (0-9, A-F).
Examples:
#FFFFFF→ White#000000→ Black#FF0000→ Red
Components of Color
The six characters in a hex code are grouped into pairs, representing Red (R), Green (G), and Blue (B).
For instance, in the hex code #FF5733:
-
FFrepresents the intensity of red. -
57represents the intensity of green. -
33represents the intensity of blue.
Usage
In CSS, hex codes can be used to specify the color of elements.
div { background-color: #ff5733; }
The code above sets the background color of the div element to #FF5733.
Short Hex Code
Sometimes, a 3-digit hex code is used to represent colors. This is useful when each color component has the same value.
Examples:
-
#FFF→#FFFFFF(White) -
#000→#000000(Black)
Type the emphasized parts of the code as instructed.
What is the most appropriate option to fill in the blank?
Lecture
AI Tutor
Design
Upload
Notes
Favorites
Help