0
0
CSSmarkup~20 mins

Background color in CSS - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Background Color Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
📝 Syntax
intermediate
2:00remaining
What is the background color of this box?
Look at the CSS code below. What color will the box show as its background?
CSS
div {
  background-color: #ff6347;
  width: 100px;
  height: 100px;
}
AA shade of orange-red (tomato color)
BA bright red color
CA dark blue color
DA light green color
Attempts:
2 left
💡 Hint
The hex code #ff6347 is known as tomato color.
rendering
intermediate
2:00remaining
Which background color will fill the entire viewport?
Given this CSS, what color will fill the entire browser window background?
CSS
body {
  background-color: rgb(0, 128, 0);
  margin: 0;
  height: 100vh;
}
AA medium green color filling the whole window
BNo background color visible because height is zero
CA transparent background showing default white
DA blue background filling the window
Attempts:
2 left
💡 Hint
The rgb(0, 128, 0) is a green color. The height 100vh means full viewport height.
selector
advanced
2:00remaining
Which CSS selector changes background color only for paragraphs inside a section?
You want to change the background color of only <p> tags inside <section> elements. Which selector does this correctly?
Ap > section { background-color: lightblue; }
Bp section { background-color: lightblue; }
Csection > p { background-color: lightblue; }
Dsection p { background-color: lightblue; }
Attempts:
2 left
💡 Hint
Think about the order: parent then child in selectors.
accessibility
advanced
2:00remaining
Why should you avoid pure black background with pure white text?
What is a main accessibility concern when using pure black (#000000) background with pure white (#FFFFFF) text?
AIt disables screen readers
BIt breaks keyboard navigation
CIt causes eye strain due to very high contrast
DIt is not readable on mobile devices
Attempts:
2 left
💡 Hint
Think about how your eyes feel reading very bright text on dark background.
🧠 Conceptual
expert
3:00remaining
What happens if you set background-color with alpha transparency on a semi-transparent element?
Consider this CSS: .box { background-color: rgba(255, 0, 0, 0.5); opacity: 0.5; width: 100px; height: 100px; } What will be the visual effect on the box's background color?
AThe box background will be fully opaque red ignoring opacity
BThe box background will be very faint red because opacity multiplies transparency
CThe box background will be solid red with no transparency
DThe box background will be invisible
Attempts:
2 left
💡 Hint
Opacity affects the whole element including background color transparency.