0
0
CSSmarkup~5 mins

Object fit in CSS - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
Recall & Review
beginner
What does the CSS property object-fit do?
It controls how an image or video fits inside its container, deciding if it should stretch, cover, or contain within the box without distortion.
Click to reveal answer
beginner
Name the five main values of object-fit.
  • fill
  • contain
  • cover
  • none
  • scale-down
Click to reveal answer
intermediate
What is the difference between object-fit: contain and object-fit: cover?

contain fits the entire image inside the container without cropping, keeping aspect ratio but may leave empty space.<br>cover fills the container completely, cropping parts if needed but keeps aspect ratio.

Click to reveal answer
beginner
Which object-fit value stretches the image to fill the container, possibly distorting it?
fill stretches the image to fill the container's width and height, ignoring the original aspect ratio, which can distort the image.
Click to reveal answer
intermediate
How does object-fit: scale-down behave?

It compares none and contain and uses the smaller size. So the image is shown at its original size or scaled down to fit inside the container without cropping.

Click to reveal answer
Which object-fit value keeps the entire image visible without cropping but may leave empty space?
Afill
Bcontain
Ccover
Dnone
What happens when you use object-fit: fill on an image?
AImage stretches to fill container, possibly distorted
BImage keeps aspect ratio and fits inside container
CImage is cropped to fill container
DImage is shown at original size
Which object-fit value shows the image at its original size without scaling?
Acontain
Bcover
Cscale-down
Dnone
If you want an image to fill the container completely but keep its aspect ratio, which object-fit value should you use?
Afill
Bcontain
Ccover
Dnone
What does object-fit: scale-down do?
AShows image at original size or smaller to fit container
BAlways scales image up to fill container
CCrops image to container size
DStretches image ignoring aspect ratio
Explain how object-fit helps control image display inside containers and why it is useful.
Think about how images behave when container sizes change.
You got /4 concepts.
    Describe the visual difference between object-fit: contain and object-fit: cover with an example.
    Imagine fitting a photo inside a frame.
    You got /4 concepts.