Challenge - 5 Problems
Object Fit Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
❓ rendering
intermediate2:00remaining
What is the visual result of this CSS?
Given this HTML and CSS, what will the image look like inside the 200x200 pixel container?
<div class='box'><img src='image.jpg' alt='Sample' /></div>.box { width: 200px; height: 200px; } img { width: 100%; height: 100%; object-fit: cover; }CSS
<div class='box'><img src='image.jpg' alt='Sample' /></div> .box { width: 200px; height: 200px; } img { width: 100%; height: 100%; object-fit: cover; }
Attempts:
2 left
💡 Hint
Think about how 'cover' affects the image size and cropping.
✗ Incorrect
The 'object-fit: cover' makes the image fill the container fully while preserving aspect ratio. It crops parts if needed to avoid distortion.
🧠 Conceptual
intermediate1:30remaining
Which object-fit value preserves the entire image without cropping?
You want an image inside a fixed-size box to show fully without any part cut off. Which
object-fit value should you use?Attempts:
2 left
💡 Hint
This value fits the whole image inside the container, possibly leaving empty space.
✗ Incorrect
'contain' scales the image to fit inside the container fully without cropping, preserving aspect ratio.
📝 Syntax
advanced1:30remaining
What error does this CSS cause?
Consider this CSS snippet:
What happens when this CSS is applied?
img { object-fit: covr; }What happens when this CSS is applied?
CSS
img { object-fit: covr; }Attempts:
2 left
💡 Hint
Browsers handle unknown CSS values by ignoring them.
✗ Incorrect
Invalid CSS property values are ignored by browsers, so the image uses the default 'fill' for object-fit.
❓ selector
advanced2:00remaining
Which CSS selector targets only images with object-fit set to 'contain'?
You want to style only images that have
object-fit: contain applied. Which selector works?Attempts:
2 left
💡 Hint
Think about how to select elements by inline style attribute.
✗ Incorrect
Only attribute selectors can match inline styles. 'img[style*="object-fit: contain"]' matches images with that style inline.
❓ accessibility
expert2:30remaining
How does object-fit affect accessibility for screen readers?
Which statement about
object-fit and accessibility is true?Attempts:
2 left
💡 Hint
Consider what screen readers use to understand images.
✗ Incorrect
Object-fit only changes how images appear visually. Screen readers rely on alt text and do not interpret CSS visual styles.