CSS zoom Property

The CSS zoom property scales an element and its contents larger or smaller while affecting how the element participates in layout.

Unlike transform: scale(), which changes an element's visual appearance without recalculating the surrounding layout, zoom affects layout calculations. It accepts positive numbers and percentages and can be useful for scaling interface components, previews, and other content that must occupy space according to its scaled dimensions.

Syntax

The zoom property accepts a positive number or percentage that specifies the scaling factor.

selector {
  zoom: <number> | <percentage>;
}

Common declarations include:

.normal-size {
  zoom: 1;
}
.smaller {
  zoom: 0.75;
}
.larger {
  zoom: 1.5;
}
.percentage-small {
  zoom: 80%;
}
.percentage-large {
  zoom: 125%;
}

A value of 1 or 100% represents normal size. Values below 1 or 100% reduce the size, while larger values increase it.

The property also accepts the CSS-wide keywords initial, inherit, unset, revert, and revert-layer.

Property Values

Value Description
<number> A positive number specifying the scaling factor. For example, 1.5 scales the element to 150% of its normal size.
<percentage> A positive percentage specifying the scaling factor. For example, 75% reduces the element to 75% of its normal size.
1 Displays the element at its normal size. This is the initial value.
initial Resets the property to 1.
inherit Explicitly uses the computed zoom value of the parent element.
unset Resets the property to 1 because zoom is not inherited.
revert Reverts the property according to the CSS cascade.
revert-layer Reverts the property according to the previous cascade layer.

The modern standardized property requires a positive scaling factor. Zero and negative values are invalid. Length units such as px and em are not accepted.

Legacy Values

Older implementations of zoom also supported nonstandard keywords such as normal and reset.

These keywords are not part of the modern standardized syntax and should not be used in new stylesheets.

How It Works

The zoom property scales the rendering of an element and its descendants.

For example:

.scaled-content {
  zoom: 1.5;
}

The element and its contents are displayed at 150% of their normal size.

Unlike a visual transform, zooming also affects layout calculations. Surrounding elements can be repositioned because the zoomed element occupies a different amount of space.

Scaling Up

Values greater than 1 enlarge the element.

.large-content {
  zoom: 2;
}

The element is displayed at twice its normal scale.

Scaling Down

Values between 0 and 1 reduce the element's size.

.small-content {
  zoom: 0.5;
}

The element is displayed at half its normal scale.

Very small zoom values can make text and controls difficult to read or interact with, so use reduced scaling carefully.

Numbers and Percentages

Numbers and percentages provide equivalent ways to express a zoom factor.

Number Percentage Result
0.5 50% Half size
0.75 75% Three-quarter size
1 100% Normal size
1.25 125% 125% of normal size
1.5 150% 150% of normal size
2 200% Double size

The following declarations are equivalent:

.example-one {
  zoom: 1.25;
}
.example-two {
  zoom: 125%;
}

Both display their elements at 125% of normal size.

Layout Behavior

One of the most important characteristics of zoom is that it affects layout.

When an element is enlarged or reduced, its scaled dimensions can influence the positioning of surrounding content.

Zooming a Block Element

.zoomed-panel {
  zoom: 1.5;
}

The panel and its contents become larger, and the layout accounts for the zoomed dimensions.

Depending on the surrounding layout, this may change available space, cause text to wrap differently, or reposition neighboring elements.

Zooming Inline Content

.highlighted-word {
  zoom: 1.25;
}

Scaling inline content can affect line layout and spacing. The exact result depends on the element's display type and surrounding content.

Zooming an Entire Section

.preview-section {
  zoom: 0.8;
}

This scales the section and its descendants to 80% of their normal size.

Because layout is affected, the section may require less displayed space than it would at normal scale.

zoom vs. transform: scale()

The zoom property and the CSS scale() transform function can both make elements appear larger or smaller, but they differ in how they affect layout.

Feature zoom transform: scale()
Changes visual size Yes Yes
Affects layout calculations Yes No, the element retains its original layout space
Scaling origin Normally top and center in horizontal writing modes Controlled by transform-origin, initially center
Supports nonuniform scaling No, a single scale factor is used Yes, separate horizontal and vertical scale factors are supported
Typical use Scaling content while allowing layout to adjust Visual effects, animations, and transformations

Using zoom

.zoom-example {
  zoom: 1.5;
}

The element becomes larger, and the layout accounts for the scaling.

Using transform: scale()

.transform-example {
  transform: scale(1.5);
}

The element becomes visually larger, but its original layout dimensions remain unchanged.

This can cause transformed content to overlap neighboring elements because the layout does not reserve additional space for the visual enlargement.

Choosing Between Them

Use zoom when scaling should affect the layout of surrounding content.

Use transform: scale() when the goal is a visual transformation, particularly for animations or effects that should not trigger layout recalculation.

Zoom Origin and Direction

The scaling origin of zoom differs from the default origin of CSS transforms.

In horizontal writing modes, zooming generally occurs from the top and horizontal center of the element.

In vertical writing modes, the origin follows the top and inline-start side.

Comparing Scaling Origins

.zoomed-box {
  zoom: 1.5;
}
.transformed-box {
  transform: scale(1.5);
  transform-origin: center;
}

The first declaration uses the scaling behavior defined for zoom. The second scales visually around the center of the element.

The transform-origin property does not control the origin of zoom.

When precise control over the scaling origin is required, a CSS transform is usually the better choice.

Nested Zoom Values

The zoom property is not inherited, but scaling applied to a parent affects how its descendants are rendered.

When a child also has a zoom value, the scaling effects combine.

.parent {
  zoom: 1.5;
}
.child {
  zoom: 2;
}

The child has its own zoom factor of 2 within a parent scaled by 1.5, producing a combined effective scaling factor of 3 relative to unzoomed content.

Resetting a Child's Zoom

.parent {
  zoom: 1.5;
}
.child {
  zoom: 1;
}

The child has a specified zoom factor of 1, but it still appears within the parent's scaled rendering.

Setting zoom: 1 on a descendant does not cancel the parent's scaling.

To avoid the parent's scaling effect, place the content outside the zoomed ancestor or reconsider the layout structure.

Examples

Example 1: Normal Size

The initial value displays content at its normal scale.

.normal-content {
  zoom: 1;
}

This is equivalent to zoom: 100%.

Example 2: Reducing Content Size

A value below 1 reduces the size of an element and its contents.

.small-preview {
  zoom: 0.75;
}

The preview is displayed at 75% of its normal size.

Example 3: Enlarging Content

A value above 1 enlarges an element and its contents.

.large-preview {
  zoom: 1.5;
}

The preview is displayed at 150% of normal size.

Example 4: Using Percentages

Percentage values can make the intended scale easier to recognize.

.scaled-card {
  zoom: 125%;
}

The card and its contents are displayed at 125% of normal size.

Example 5: Using a CSS Custom Property

A custom property can control the scaling factor.

.preview {
  --preview-zoom: 1.25;
  zoom: var(--preview-zoom);
}

Changing --preview-zoom updates the zoom level.

Example 6: Responsive Scaling

Media queries can apply different zoom factors at different viewport widths.

.preview-panel {
  zoom: 1;
}
@media (max-width: 600px) {
  .preview-panel {
    zoom: 0.85;
  }
}

This reduces the preview to 85% on smaller screens.

For ordinary responsive layouts, adjusting font sizes, widths, spacing, and layout rules is generally preferable to shrinking entire sections with zoom.

Inheritance

The zoom property is not inherited. Each element has its own computed zoom value, which defaults to 1.

.parent {
  zoom: 1.5;
}
.child {
  /* Computed zoom is 1 */
}

Although the child does not inherit the property, it is still rendered within the parent's scaled content.

The inherit keyword explicitly copies the parent's computed zoom value.

.parent {
  zoom: 1.5;
}
.child {
  zoom: inherit;
}

In this example, the child receives its own zoom factor of 1.5 in addition to the parent's scaling.

This distinction is important when working with nested components.

Practical Example

This example compares three elements displayed at 75%, 100%, and 125% of their normal size. Each element uses the same dimensions, padding, and typography before zooming.

HTML

<div class="zoom-demo">
  <div class="zoom-example">
    <strong>zoom: 75%</strong>
    <div class="zoom-box zoom-small">
      <span>CSS Zoom</span>
    </div>
  </div>
  <div class="zoom-example">
    <strong>zoom: 100%</strong>
    <div class="zoom-box zoom-normal">
      <span>CSS Zoom</span>
    </div>
  </div>
  <div class="zoom-example">
    <strong>zoom: 125%</strong>
    <div class="zoom-box zoom-large">
      <span>CSS Zoom</span>
    </div>
  </div>
</div>

CSS

.zoom-demo {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 20px;
}
.zoom-example {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}
.zoom-example strong {
  font-size: 14px;
}
.zoom-box {
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 120px;
  height: 80px;
  padding: 10px;
  border: 2px solid #2471a3;
  background: #d6eaf8;
  color: #1b4f72;
  font-size: 16px;
  font-weight: bold;
}
.zoom-small {
  zoom: 75%;
}
.zoom-normal {
  zoom: 100%;
}
.zoom-large {
  zoom: 125%;
}
Browser Result
zoom: 75%
CSS Zoom
zoom: 100%
CSS Zoom
zoom: 125%
CSS Zoom

Result: The first box is reduced to 75% of normal size, the second remains at 100%, and the third is enlarged to 125%. Both the boxes and their text scale together.

The Flexbox layout accounts for the zoomed dimensions when arranging the examples.

Common Mistakes

Confusing zoom with Browser Zoom

The CSS zoom property is not the same as the browser's page zoom feature.

Browser zoom changes the magnification of the page as a whole, while CSS zoom scales specific elements or sections.

Do not use CSS zoom to prevent or replace browser zoom functionality.

Using Zero or Negative Values

The standardized zoom property requires a positive scaling factor.

/* Incorrect */
.element {
  zoom: 0;
}
/* Incorrect */
.element {
  zoom: -1;
}
/* Correct */
.element {
  zoom: 0.5;
}

Using Length Units

The zoom property accepts numbers and percentages, not CSS lengths.

/* Incorrect */
.element {
  zoom: 20px;
}
/* Correct */
.element {
  zoom: 120%;
}

Expecting the Same Layout Behavior as scale()

The zoom property affects layout calculations, while transform: scale() does not change the element's original layout space.

Choose the property based on whether surrounding content should respond to the scaling.

Assuming zoom Is Inherited

The property is not inherited, although descendants are affected by the parent's scaling.

Setting zoom: 1 on a child does not undo an ancestor's zoom.

Using zoom to Fix Responsive Layout Problems

Shrinking an entire interface with zoom may make text and controls too small.

For responsive design, prefer flexible widths, appropriate typography, media queries, and layout adjustments.

Expecting transform-origin to Affect zoom

The transform-origin property controls the origin of CSS transforms, not the origin used by zoom.

Use transform: scale() when a custom scaling origin is required.

Important Considerations

  • Scaling factor: A value of 1 or 100% represents normal size.
  • Valid values: Positive numbers and percentages are supported. Zero and negative values are invalid.
  • Layout effects: Zooming affects layout calculations and can change the position of surrounding content.
  • Inheritance: The property is not inherited, but parent scaling affects descendants.
  • Nested scaling: Zoom factors on nested elements combine.
  • Scaling origin: The zoom origin differs from the default origin of CSS transforms.
  • Animation: The zoom property is not animatable in the standardized definition.
  • Browser zoom: CSS zoom does not replace the browser's page magnification controls.
  • Accessibility: Avoid scaling essential text or interactive controls so small that they become difficult to read or use.
  • Responsive design: Use flexible layouts and media queries rather than relying on zoom to fit an entire interface onto smaller screens.

The zoom property is most useful when an element and its contents must be scaled together and the surrounding layout should account for the change.

Browser Support

The CSS zoom property is considered Baseline 2024 and is available across current versions of major browsers, including Chrome, Edge, Firefox, Safari, and Opera.

Historically, zoom was a nonstandard property supported by several browsers. It became standardized and gained broader interoperable support in 2024.

Older browser versions may differ in their handling of zoom values and layout behavior. Test the property when supporting legacy browsers.

For current compatibility information, visit Can I Use? .

Specifications

The zoom property is defined in the CSS Viewport Module Level 1 specification.