Knowledge baseExam Center
ENEnglish
Choose language13

CKTIS / CSS

object-view-box — the content reference region

object-view-box selects a rectangular region of a replaced element’s content, enabling zooming and panning.

Version: CSS modules; structured CSSWG indexes reconciled with pinned MDN BCD; Chromium 152 scope gate, per-example verification still required

Syntax

object-view-box: none | <basic-shape-rect>;

object-view-box applies to replaced elements. The initial value none means no additional view box; the property is not inherited. Without both a natural width and height, it has no effect.

<basic-shape-rect> defines a rectangle relative to the content’s natural dimensions. In the example, inset(0 50% 0 0) moves the right edge inward by half the width, selecting the image’s left half.

The region’s dimensions replace the natural dimensions for layout purposes; object-fit and object-position then operate on that region. This is not simply a clip-path mask: content outside the region can remain visible depending on fitting.

The specification is a draft; zero-area behavior remains undefined. Verify rendering in the target browser before deployment.

Examples

<!doctype html>
<meta charset="utf-8">
<title>object-view-box</title>
<style>
  img {
    display: block;
    width: 200px;
    height: 100px;
    object-fit: fill;
    object-view-box: inset(0 50% 0 0);
  }
</style>
<img alt="Two-color test image" width="200" height="100"
  src="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='100'%3E%3Cpath fill='red' d='M0 0h100v100H0z'/%3E%3Cpath fill='blue' d='M100 0h100v100H100z'/%3E%3C/svg%3E">

Result

Supported rendering: a solid red 200 × 100 CSS-pixel rectangle. If the declaration is ignored: red left half and blue right half.

The displayed code and declared result were verified in an isolated environment using the method recorded in the verification evidence for this exact version.

Sources