`dynamic-range-limit` CSS property
The dynamic-range-limit CSS property specifies the maximum luminance allowed for High Dynamic Range (HDR) content.
The **`dynamic-range-limit`** [CSS](/docs/Web/CSS) property specifies the maximum luminance allowed for High Dynamic Range (HDR) content.
## Syntax
```css
/* 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`](/docs/Web/HTML/Reference/Global_attributes/tabindex) value of `0` to make the image focusable via the keyboard.
```html
<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.
```css
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.
```css
img:hover,
img:focus {
dynamic-range-limit: no-limit;
}
```
```css hidden
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
300
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
- [`dynamic-range`](/docs/Web/CSS/Reference/At-rules/@media/dynamic-range) and [`video-dynamic-range`](/docs/Web/CSS/Reference/At-rules/@media/video-dynamic-range) media features
Cite this
"`dynamic-range-limit` CSS property". MDN Web Docs. CC BY-SA 2.5 (MDN). https://developer.mozilla.org/en-US/docs/Web/CSS/Reference/Properties/dynamic-range-limit JSON record · API collection · BibTeX · RIS · CSL-JSON · citation policy