Ctrl + K
HomeCSS ToolsCSS Object Fit Playground
Free Developer Tool

CSS Object Fit Playground

Preview how CSS object-fit values control image and video sizing.

320px
240px
Object fit preview

What is CSS Object Fit Playground?

Experiment with CSS object-fit values and see how images or videos are resized and positioned inside their containers.

How to use

  1. Choose an object-fit value.
  2. Adjust the preview container if needed.
  3. Compare the resulting media behavior.
  4. Copy the generated CSS.

Features

  • Live object-fit preview
  • Common object-fit values
  • Container size controls
  • Generated CSS

Common Use Cases

  • Image galleries
  • Responsive cards
  • Video containers
  • Media component development

Example

Input
object-fit: cover;
Output
.image {
  width: 100%;
  height: 300px;
  object-fit: cover;
}

FAQ

What does object-fit do?

The object-fit property controls how replaced content such as images and videos fits inside its assigned dimensions.

What is the difference between cover and contain?

Cover fills the container while preserving the media ratio and may crop the content. Contain displays the complete content while preserving empty space when necessary.

Can object-fit be used with videos?

Yes. The property can be used with images, videos and other replaced elements.