object-view-box

Allows you to specify a 'view box' for an image or video, similar to how viewBox works in SVG. This essentially lets you crop or zoom into a specific part of a replaced element using CSS.

It is documented as part of the CSS Images specification. This is an experimental technology. The syntax and behavior are still subject to change.

/* Usage Example */
.zoomed-image {
  /* Crops the image to a specific rectangle area */
  object-view-box: inset(10% 20% 30% 40%);
}

/* Syntax */
object-view-box: none;

/* Global values */
object-view-box: inherit;
object-view-box: initial;
object-view-box: revert;
object-view-box: revert-layer;
object-view-box: unset;
Limited availability Since 2020 79% global usage

This feature is not Baseline because it does not work in some of the most widely-used browsers.

104+
104+
Kinsta

Your first month is free

Managed WordPress hosting for faster sites.

Learn more

New CSS drops.

Join 600+ readers who've survived clearfix hacks.

ESC