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 does RGB stand for in CSS colors?
RGB stands for Red, Green, and Blue. These are the three colors combined in different amounts to create many colors on screens.
Click to reveal answer
beginner
How do you write an RGB color in CSS?
You write it as rgb(red, green, blue) where red, green, and blue are numbers from 0 to 255 showing how much of each color you want.
Click to reveal answer
beginner
What extra feature does RGBA have compared to RGB?
RGBA adds an alpha value for transparency. It lets you make colors see-through by setting alpha from 0 (invisible) to 1 (fully visible).
Click to reveal answer
beginner
Example: What color does rgba(255, 0, 0, 0.5) create?
It creates a semi-transparent red color. Red is full (255), green and blue are zero, and alpha 0.5 means 50% see-through.
Click to reveal answer
intermediate
Why is using RGBA useful in web design?
RGBA helps create layered designs by letting background colors show through. It improves look and feel with shadows, overlays, and smooth effects.
Click to reveal answer
What is the range of values for each color in rgb()?
A0 to 1
B0 to 100
C0 to 255
D1 to 255
✗ Incorrect
Each color in rgb() uses a number from 0 (none) to 255 (full) to set the amount of red, green, or blue.
What does the alpha value in rgba() control?
ATransparency
BSaturation
CHue
DBrightness
✗ Incorrect
Alpha controls how see-through the color is, from 0 (invisible) to 1 (fully visible).
Which CSS color function allows transparency?
Argb()
Bhsl()
Chex
Drgba()
✗ Incorrect
Only rgba() includes an alpha channel for transparency.
What color does rgb(0, 0, 255) represent?
AGreen
BBlue
CRed
DBlack
✗ Incorrect
It is pure blue because blue is 255 and red and green are 0.
If you want a fully transparent color, what alpha value do you use in rgba()?
A0
B1
C255
D100
✗ Incorrect
Alpha 0 means fully transparent (invisible).
Explain how RGB colors work and how RGBA adds transparency.
Think about mixing light colors and adding see-through effect.
You got /3 concepts.
Describe a real-life example where you might use RGBA in web design.
Imagine putting a tinted glass over a picture.
You got /3 concepts.
Practice
(1/5)
1. What does the rgba(255, 0, 0, 0.5) color value represent in CSS?
easy
A. A solid black color
B. A fully opaque green color
C. A fully transparent blue color
D. A semi-transparent red color
Solution
Step 1: Understand RGBA components
The first three numbers (255, 0, 0) represent red, green, and blue. Here, red is full (255), green and blue are zero.
Step 2: Interpret the alpha value
The last number 0.5 means 50% transparency, so the color is semi-transparent.
Final Answer:
A semi-transparent red color -> Option D
Quick Check:
RGBA = red + transparency = semi-transparent red [OK]
Hint: RGBA adds transparency as the last number [OK]
Common Mistakes:
Confusing RGB with RGBA
Ignoring the alpha transparency value
Mixing up color order (RGB)
Thinking 0.5 means fully opaque
2. Which of the following is the correct syntax for a fully opaque blue color using RGB in CSS?
easy
A. rgb(255, 0, 0, 1)
B. rgb(0, 0, 255)
C. rgba(0, 0, 255)
D. rgba(255, 255, 0)
Solution
Step 1: Recall RGB syntax
RGB uses three numbers for red, green, and blue. The format is rgb(red, green, blue).
Step 2: Check the options
rgb(0, 0, 255) uses rgb with three values and sets blue to 255, which is correct for blue color.
Final Answer:
rgb(0, 0, 255) -> Option B
Quick Check:
RGB needs 3 values, no alpha [OK]
Hint: RGB uses exactly 3 numbers, no alpha [OK]
Common Mistakes:
Using rgba without alpha value
Adding extra values in rgb
Mixing order of colors
Using rgba with missing parameters
3. What color and transparency will the following CSS produce?
background-color: rgba(0, 128, 0, 0.3);
medium
A. A semi-transparent green color
B. A solid green color
C. A semi-transparent red color
D. A fully transparent color
Solution
Step 1: Identify RGB values
The values (0, 128, 0) mean no red, medium green, no blue, so the color is green.
Step 2: Interpret alpha transparency
The alpha value 0.3 means 30% opacity, so the color is mostly transparent but visible.
Final Answer:
A semi-transparent green color -> Option A
Quick Check:
RGBA = green + 30% opacity = semi-transparent green [OK]
Hint: Alpha less than 1 means some transparency [OK]
Common Mistakes:
Assuming alpha 0.3 means fully opaque
Mixing up RGB color order
Confusing green with red or blue
Ignoring alpha value
4. Find the error in this CSS color declaration:
color: rgba(255, 255, 255, 2);
medium
A. RGB values must be between 0 and 100
B. Missing semicolon after rgba
C. Alpha value cannot be greater than 1
D. RGBA requires 5 parameters
Solution
Step 1: Check alpha value range
Alpha in rgba must be between 0 (transparent) and 1 (opaque). Here it is 2, which is invalid.
Step 2: Verify other parts
RGB values 255 are valid, semicolon is present, and rgba takes 4 parameters, so no other errors.
Final Answer:
Alpha value cannot be greater than 1 -> Option C
Quick Check:
Alpha must be 0 to 1 [OK]
Hint: Alpha must be between 0 and 1 inclusive [OK]
Common Mistakes:
Using alpha > 1
Confusing RGB max values
Forgetting semicolon (not error here)
Adding extra parameters
5. You want a background color that is red with 40% opacity over a white page. Which CSS rule correctly achieves this effect?
hard
A. background-color: rgba(255, 0, 0, 0.4);
B. background-color: rgb(255, 0, 0, 0.4);
C. background-color: rgba(255, 255, 255, 0.4);
D. background-color: rgb(255, 0, 0); opacity: 0.4;
Solution
Step 1: Choose correct function for transparency
Only rgba() supports alpha transparency as the fourth parameter. rgb() does not.
Step 2: Verify color and transparency
background-color: rgba(255, 0, 0, 0.4); uses red (255, 0, 0) with alpha 0.4, which means 40% opacity (60% transparent), exactly what is needed.
Step 3: Check other options
background-color: rgb(255, 0, 0, 0.4); uses rgb with 4 parameters (invalid). background-color: rgba(255, 255, 255, 0.4); uses white color, not red. background-color: rgb(255, 0, 0); opacity: 0.4; sets opacity on the whole element, which affects all content, not just background.
Final Answer:
background-color: rgba(255, 0, 0, 0.4); -> Option A
Quick Check:
RGBA with alpha = 0.4 for semi-transparent red [OK]
Hint: Use rgba() for color + transparency in one step [OK]