0
0
CSSmarkup~20 mins

RGB and RGBA in CSS - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
RGBA Mastery Badge
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate
2: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?
AThe div will appear as a solid red color with no transparency.
BThe div will appear completely transparent, showing only the white background.
CThe div will appear as a semi-transparent red, allowing the white background to show through faintly.
DThe div will appear as a solid white color, ignoring the red values.
Attempts:
2 left
💡 Hint
Remember that the alpha value in RGBA controls transparency from 0 (fully transparent) to 1 (fully opaque).
📝 Syntax
intermediate
2:00remaining
Correct RGBA Syntax
Which of the following CSS color declarations is syntactically correct for an RGBA color?
Abackground-color: rgba(255,255,255,255);
Bbackground-color: rgba(255, 255, 255, 1);
Cbackground-color: rgba(255 255 255 / 1);
Dbackground-color: rgba(255, 255, 255);
Attempts:
2 left
💡 Hint
RGBA requires four values: red, green, blue, and alpha, with commas separating the first three and the alpha last.
rendering
advanced
2: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?
AA solid blue color with no yellow visible.
BA solid yellow color with no blue visible.
CA gray color because blue and yellow cancel each other out.
DA blend of blue and yellow producing a greenish color due to transparency.
Attempts:
2 left
💡 Hint
Think about how semi-transparent blue over solid yellow mixes colors visually.
selector
advanced
2: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)?
A[style='background-color: rgba(0, 128, 0, 0.7)']
B[style^='background-color: rgba(0, 128, 0, 0.7)']
C[style$='background-color: rgba(0, 128, 0, 0.7)']
D[style*='background-color: rgba(0, 128, 0, 0.7)']
Attempts:
2 left
💡 Hint
Attribute selectors with = match exact attribute values.
accessibility
expert
3: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?
AUse white text with a strong text-shadow to increase contrast against the semi-transparent background.
BUse the same color as the background for the text to create a subtle effect.
CUse black text without any shadow because the background is already dark.
DRemove the background color to avoid any transparency issues.
Attempts:
2 left
💡 Hint
Contrast and clarity are key for accessibility.