0
0
CSSmarkup~20 mins

Background position in CSS - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Background Position Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
rendering
intermediate
2:00remaining
What is the visual result of this CSS background position?
Given this CSS snippet, where will the background image appear inside the box?

div {
  width: 200px;
  height: 200px;
  background-image: url('image.png');
  background-position: right bottom;
  background-repeat: no-repeat;
  border: 1px solid black;
}
AThe image is placed at the center of the box.
BThe image is stretched to fill the entire box.
CThe image is placed at the top-left corner of the box.
DThe image is placed at the bottom-right corner of the box.
Attempts:
2 left
💡 Hint
Think about the keywords 'right' and 'bottom' in background-position.
📝 Syntax
intermediate
2:00remaining
Which CSS background-position value is valid?
Choose the only valid CSS background-position value from these options:
Abackground-position: 50% 50%;
Bbackground-position: left-top;
Cbackground-position: center-middle;
Dbackground-position: 100px 100px 50px;
Attempts:
2 left
💡 Hint
Valid values can be keywords or two length/percentage values.
🧠 Conceptual
advanced
2:00remaining
What happens if you use 'background-position: 150% 150%'?
If a box is 200px by 200px and the background image is 100px by 100px, what is the effect of setting background-position: 150% 150%?
AThe image is stretched to 150% of the box size.
BThe image is positioned outside the box, shifted beyond the bottom-right corner.
CThe image is tiled starting at 150px from top-left.
DThe image is centered inside the box.
Attempts:
2 left
💡 Hint
Percentages in background-position are relative to the box size.
selector
advanced
2:00remaining
Which CSS selector targets elements with background-position set to 'center'?
You want to style only elements that have background-position: center; set inline or in CSS. Which selector works?
A[style*='background-position: center']
B:has(background-position=center)
C.background-position-center
D[background-position='center']
Attempts:
2 left
💡 Hint
Attribute selectors can match inline styles.
accessibility
expert
2:00remaining
How to ensure background-position changes do not reduce accessibility?
If you use background-position to move decorative images, what should you do to keep your page accessible?
AUse background-position only on images with important content.
BAdd alt text describing the background image in CSS.
CUse <code>aria-hidden="true"</code> on elements with decorative backgrounds.
DAvoid using background images altogether.
Attempts:
2 left
💡 Hint
Decorative images should be hidden from screen readers.