0
0
CSSmarkup~20 mins

CSS syntax and rules - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
CSS Syntax Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
📝 Syntax
intermediate
2:00remaining
What is the output of this CSS snippet?
Given the CSS below, what color will the paragraph text be rendered in a browser?
CSS
p { color: blue; color: red; }
ABlue
BGreen
CBlack (default)
DRed
Attempts:
2 left
💡 Hint
Later rules override earlier ones if they have the same specificity.
selector
intermediate
2:00remaining
Which selector matches only direct children?
Which CSS selector matches only the direct children of a div element?
Adiv p
Bdiv > p
Cdiv + p
Ddiv ~ p
Attempts:
2 left
💡 Hint
Look for the selector that uses the child combinator symbol.
layout
advanced
2:00remaining
What layout will this CSS produce?
Given the CSS below, how will the three boxes be arranged visually?
CSS
.container {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
.box {
  width: 100px;
  height: 100px;
  background-color: lightblue;
}
ABoxes arranged vertically in a column with space between
BBoxes arranged horizontally in a row with space between
CBoxes stacked on top of each other with no space
DBoxes arranged randomly with overlapping
Attempts:
2 left
💡 Hint
Check the flex-direction property value.
accessibility
advanced
2:00remaining
Which CSS rule improves text accessibility?
Which CSS rule below best improves text readability for users with visual impairments?
Ap { color: #999; background-color: #999; }
Bp { color: #777; background-color: #eee; }
Cp { color: #000; background-color: #fff; }
Dp { color: #ccc; background-color: #ddd; }
Attempts:
2 left
💡 Hint
Good contrast between text and background helps readability.
🧠 Conceptual
expert
2:00remaining
What error does this CSS cause?
What error or issue will this CSS cause when applied in a browser?
CSS
div {
  color: blue;
  background-color: yellow;
}
ASyntax error due to missing semicolon after color property
BBackground color will not apply but no error
CBoth properties apply correctly
DBrowser crashes
Attempts:
2 left
💡 Hint
Check punctuation between CSS declarations.