大网数据广告活动
Web 标准与前端开发

`dynamic-range-limit` CSS property

· 52CE 我爱测

The **`dynamic-range-limit`** CSS property specifies the maximum luminance allowed for High Dynamic Range (HDR) content.

The dynamic-range-limit CSS property specifies the maximum luminance allowed for High Dynamic Range (HDR) content.

Syntax

/* Keyword values */
dynamic-range-limit: standard;
dynamic-range-limit: no-limit;
dynamic-range-limit: constrained;

/* dynamic-range-limit-mix() function */
dynamic-range-limit: dynamic-range-limit-mix(standard 70%, no-limit 30%);

/* Global values */
dynamic-range-limit: inherit;
dynamic-range-limit: initial;
dynamic-range-limit: revert;
dynamic-range-limit: revert-layer;
dynamic-range-limit: unset;

Values

This property is specified as a single value from the following list:

  • standard
    • : Specifies the maximum luminance as High Dynamic Range (HDR) reference white, which is the CSS color white.
  • no-limit
    • : Specifies the maximum luminance as much greater than that of HDR reference white. The precise level is not specified. This is the initial value.
  • constrained
    • : Specifies the maximum luminance as somewhat greater than that of HDR reference white, such that a mix of Standard Dynamic Range (SDR) and HDR content can be comfortably viewed together. The precise level is not specified.
  • dynamic-range-limit-mix()
    • : Specifies the maximum luminance as a custom value that is a combination of the different keyword values proportionate to the provided percentages. It takes two or more pairs, each consisting of a dynamic-range-limit keyword or a nested dynamic-range-limit-mix() function and a percentage.

Description

The dynamic-range-limit property specifies the maximum luminance allowed in displays capable of displaying high dynamic range colors. A dynamic range is the difference in luminance (brightness) between the lightest and darkest parts of content. Dynamic range is measured in photographic stops, where an increase of one stop represents a doubling of the luminance.

SDR, HDR, and headroom

Traditional web content uses Standard Dynamic Range (SDR), where the brightest color is equivalent to the CSS color white (#ffffff in hexadecimal). The brightness in High Dynamic Range (HDR) content, on the other hand, can go beyond the standard white. In HDR terminology, the standard CSS white is also called the HDR reference white.

The peak luminance at which content can be displayed depends on the content, the available display hardware, and user preferences. The amount by which the peak luminance of white can exceed HDR reference white is termed HDR headroom and is typically expressed in photographic stops.

SDR content always has an HDR headroom of 0 because its brightest white is the HDR reference white. Older monitors may also have an HDR headroom of 0 because they are not able to display brighter colors. Newer monitors may have an HDR headroom greater than 0, allowing them to display the brighter colors available in HDR content.

The use-case for dynamic-range-limit

The brightness of HDR content can be jarring to the viewer. This is especially apparent in apps where a mixture of HDR and SDR content is displayed, leading to inconsistency in the brightness.

The dynamic-range-limit property allows you to control the brightness of HDR content. For example, you might want to constrain the maximum brightness of all thumbnails in a photo or video gallery to HDR reference white (this is what the standard keyword value does) or to a brightness only slightly more than the HDR reference white (using the constrained keyword value or a custom limit created using dynamic-range-limit-mix()). When a user views a single HDR image, or if the user selects a preference to enable it, you could then set the image's dynamic-range-limit to no-limit.

Formal definition

Formal syntax

Examples

Basic dynamic-range-limit usage

This example demonstrates the basic use of the dynamic-range-limit property and the difference between HDR and SDR images.

HTML

In the markup, we embed an HDR image using an img element. We include a tabindex value of 0 to make the image focusable via the keyboard.

<img
  src="https://mdn.github.io/shared-assets/images/examples/ultra-hdr.jpg"
  alt="A subway station platform with bright white overhead strip lights"
  tabindex="0" />

CSS

We constrain the image to SDR brightness by setting the dynamic-range-limit property to standard, which makes the image no brighter than HDR reference white. We also set a transition property so that the <img> element's dynamic-range-limit value transitions over 0.6 seconds when its state changes.

img {
  dynamic-range-limit: standard;
  transition: dynamic-range-limit 0.6s;
}

On hover or focus, we change the value of the <img> element's dynamic-range-limit to no-limit so that it displays as brightly as the browser and display setup allow.

img:hover,
img:focus {
  dynamic-range-limit: no-limit;
}
img {
  max-height: 100vh;
}
@media not (dynamic-range: high) {
  body::before {
    content: "Your device may not display the image at full brightness.";
    background-color: wheat;
    display: block;
    text-align: center;
  }
}
@supports not (dynamic-range-limit: standard) {
  body::before {
    content: "Your browser doesn't support the dynamic-range-limit property.";
    background-color: wheat;
    display: block;
    text-align: center;
  }
}

Results

Examples

The image is ultra HDR but is constrained to SDR brightness by default. Hover over or focus the image. Note how it transitions to vivid HDR colors on capable displays.

Specifications

Browser compatibility

See also

来源:MDN Web Docs / Mozilla 贡献者 · 作者与贡献记录 · CC BY-SA 2.5。离线整理了版式、链接和媒体显示。

资料来源与适用范围

资料来源
MDN Web Docs / Mozilla 贡献者
适用范围
请按文中版本与环境说明核对
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 2.5

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。