Jump into concepts and practice - no test required
or
Recommended
Test this pattern10 questions across easy, medium, and hard to know if this pattern is strong
Recall & Review
beginner
What is a hex color code in CSS?
A hex color code is a way to represent colors using a 6-digit combination of numbers and letters starting with #. It shows the amount of red, green, and blue in the color.
Click to reveal answer
beginner
How do you write pure red using a hex color code?
Pure red is written as #FF0000. The first two digits (FF) are red, the next two (00) green, and the last two (00) blue.
Click to reveal answer
beginner
What does the hex color #000000 represent?
It represents black. All colors are at zero intensity: red=00, green=00, blue=00.
Click to reveal answer
intermediate
Can hex colors use 3 digits instead of 6? How?
Yes. A 3-digit hex color like #F0A is a shortcut for #FF00AA. Each digit is doubled to make the full 6-digit code.
Click to reveal answer
beginner
Why are hex colors useful in web design?
They are easy to write, widely supported, and let you pick exact colors by mixing red, green, and blue values.
Click to reveal answer
What does the hex color #00FF00 represent?
AGreen
BBlue
CRed
DBlack
✗ Incorrect
#00FF00 means no red (00), full green (FF), and no blue (00), so it is green.
Which hex code is the shorthand for #112233?
A#112233
B#123
C#1233
DNo shorthand
✗ Incorrect
Shorthand works when each pair has identical digits. #112233 has pairs 11, 22, 33, so the shorthand is #123.
What color does #FFFFFF represent?
AGray
BBlack
CYellow
DWhite
✗ Incorrect
#FFFFFF means full red, green, and blue, which combine to white.
How many digits are in a full hex color code?
A3
B4
C6
D8
✗ Incorrect
A full hex color code has 6 digits after the # sign.
What does the first two digits in a hex color code represent?
ARed intensity
BGreen intensity
CBlue intensity
DOpacity
✗ Incorrect
The first two digits show how much red is in the color.
Explain how hex color codes represent colors in CSS.
Think about how red, green, and blue mix to make colors.
You got /4 concepts.
Describe the difference between 3-digit and 6-digit hex color codes.
Shorter codes save typing but mean the same color.
You got /4 concepts.
Practice
(1/5)
1. What does the hex color code #FF0000 represent in CSS?
easy
A. Black color
B. Bright green color
C. Bright red color
D. Bright blue color
Solution
Step 1: Understand hex color format
Hex colors start with # followed by 6 digits: two for red, two for green, two for blue.
Step 2: Analyze the code #FF0000
The first two digits FF mean full red, the next two 00 mean no green, and the last two 00 mean no blue.
Final Answer:
Bright red color -> Option C
Quick Check:
Red = FF, Green = 00, Blue = 00 [OK]
Hint: First two hex digits control red color intensity [OK]
Common Mistakes:
Confusing red with green or blue
Ignoring the order of RGB in hex
Thinking #FF0000 is black
2. Which of the following is the correct syntax for a hex color in CSS?
easy
A. #12345G
B. 123456
C. #XYZ123
D. #1A2B3C
Solution
Step 1: Check hex color syntax rules
A valid hex color starts with # followed by exactly 6 hexadecimal digits (0-9, A-F).
Step 2: Validate each option
#12345G has a 'G' which is invalid. 123456 misses the #. #1A2B3C has valid digits and #. #XYZ123 has invalid letters 'X' and 'Z'.
Final Answer:
#1A2B3C -> Option D
Quick Check:
Valid hex = # + 6 hex digits [OK]
Hint: Hex colors start with # and use digits 0-9, A-F only [OK]
Common Mistakes:
Using letters outside A-F
Omitting the # symbol
Using fewer or more than 6 digits
3. What color will the CSS rule color: #00FF00; display on the webpage?
medium
A. Green
B. Blue
C. Red
D. Yellow
Solution
Step 1: Decode the hex color #00FF00
The first two digits 00 mean no red, the next two FF mean full green, and the last two 00 mean no blue.
Step 2: Identify the color from RGB values
Full green with no red or blue results in bright green color.
Final Answer:
Green -> Option A
Quick Check:
Green = FF, Red & Blue = 00 [OK]
Hint: Middle two hex digits control green color [OK]
Common Mistakes:
Mixing up red and green positions
Assuming #00FF00 is blue
Ignoring hex digit order
4. You wrote background-color: #12345; in your CSS. What is the problem?
medium
A. Hex code is missing one digit
B. Hex code has invalid letters
C. Hex code should start with '0x'
D. Hex code is correct
Solution
Step 1: Count digits in the hex code
The code #12345 has only 5 digits after the #, but hex colors require exactly 6 digits.
Step 2: Check other options
Letters are valid digits (1,2,3,4,5). Hex colors do not start with '0x' in CSS. So the only issue is missing one digit.
Final Answer:
Hex code is missing one digit -> Option A
Quick Check:
Hex colors need 6 digits after # [OK]
Hint: Count digits after #; must be exactly 6 [OK]
Common Mistakes:
Using 3, 5, or 7 digits instead of 6
Confusing hex with other number formats
Thinking '0x' prefix is needed
5. You want a color with equal parts red and blue but no green. Which hex code should you use?
hard
A. #00FFFF
B. #FF00FF
C. #FFFF00
D. #0000FF
Solution
Step 1: Understand RGB parts in hex
Hex colors are #RRGGBB. Equal red and blue means red and blue digits are the same, green digits are zero.
Step 2: Check each option
#FF00FF: #FF00FF has red = FF, green = 00, blue = FF (equal red and blue, no green). #00FFFF has green = FF. #FFFF00 has green = FF. #0000FF has no red.
Final Answer:
#FF00FF -> Option B
Quick Check:
Red = Blue, Green = 00 means magenta [OK]
Hint: Set green digits to 00, red and blue equal [OK]