Challenge - 5 Problems
RGBA Mastery Badge
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate2:00remaining
Understanding RGBA Transparency
What will be the visible effect of applying
background-color: rgba(255, 0, 0, 0.3); to a div placed over a white background?Attempts:
2 left
💡 Hint
Remember that the alpha value in RGBA controls transparency from 0 (fully transparent) to 1 (fully opaque).
✗ Incorrect
The alpha value 0.3 means the red color is 30% opaque and 70% transparent, so the white background partially shows through, making the red appear lighter and see-through.
📝 Syntax
intermediate2:00remaining
Correct RGBA Syntax
Which of the following CSS color declarations is syntactically correct for an RGBA color?
Attempts:
2 left
💡 Hint
RGBA requires four values: red, green, blue, and alpha, with commas separating the first three and the alpha last.
✗ Incorrect
Option B uses the correct syntax with commas separating red, green, blue, and alpha values. Option B uses 255 for alpha which is invalid (alpha must be between 0 and 1). Option B uses a newer CSS syntax but is not standard rgba() syntax. Option B is missing the alpha value.
❓ rendering
advanced2:00remaining
Visual Result of Overlapping RGBA Layers
Given two overlapping
div elements, one with background-color: rgba(0, 0, 255, 0.5); and the other behind it with background-color: rgb(255, 255, 0);, what color will the overlapping area appear as?Attempts:
2 left
💡 Hint
Think about how semi-transparent blue over solid yellow mixes colors visually.
✗ Incorrect
The semi-transparent blue (50% opacity) overlays the solid yellow, mixing the colors visually. Blue and yellow combine to create a greenish tint in the overlapping area.
❓ selector
advanced2:00remaining
Selecting Elements by RGBA Background Color
Which CSS selector will correctly select all elements with a background color exactly set to
rgba(0, 128, 0, 0.7)?Attempts:
2 left
💡 Hint
Attribute selectors with = match exact attribute values.
✗ Incorrect
Option A uses the exact match selector which selects elements whose style attribute exactly equals the given string. Other options select partial matches which may select unintended elements.
❓ accessibility
expert3:00remaining
Ensuring Text Readability on RGBA Backgrounds
You have a
div with background-color: rgba(0, 0, 0, 0.4); overlaying an image. Which approach best improves text readability inside this div for users with visual impairments?Attempts:
2 left
💡 Hint
Contrast and clarity are key for accessibility.
✗ Incorrect
White text with a strong text-shadow stands out clearly against a semi-transparent dark background, improving readability for users with low vision. Black text would blend in, same color text is invisible, and removing background loses visual layering.