::backdrop - Selector CSS

::backdrop

Summary of characteristics of the ::backdrop selector

Quick description
A pseudo-element targeting the element added by browsers behind dialog boxes or elements displayed in full screen.
Status
Standard
Predefined values
dialog | fullscreen
W3C Module
Selectors

::backdrop pseudo-element - Description.

When an element is displayed in full screen or modal (dialog), the browser inserts an opaque element behind it as large as the viewport. This is to hide the page behind it. The ::backdrop pseudo-element targets this browser-added element.

Careful! We are talking about elements of the page displayed in full screen, and not about the browser window (which can pass in full screen by pressing the F11 key on Windows or Mac Intosh CMD key+F on MacIntosh).

Displaying in full screen or opening a dialog box is generally done by Javascript code, of which the following An example below:

function fullScreen(element) { element.requestFullscreen(); } function openDialog(element) { element.showModal(); } function closeDialog(element) { element.close(); }

See also the page on the :fullscreen pseudo-class, which targets elements displayed in full screen.

::backdrop pseudo-element - Examples of use.

A click on the image below displays it in full screen (the esc key restores it to its original size). The ::backdrop pseudo-element has been used to set the background behind the image when it is displayed in full screen.

Example with the pseudo-element ::backdrop

This second example concerns a dialog box (HTML dialog tag) that can be displayed in modal by the . Styles applied to the ::backdrop pseudo-element fade the page in the background.

This is a dialog box that dims the page in the background

::backdrop pseudo-element - Browser compatibility.

The ::backdrop pseudo-element is correctly recognized by browsers.

Column 1
Support for the pseudo-element ::backdrop that targets the element intended to partially or fully obscure the page when an element is displayed in fullscreen.

Notes:

(1) Supporté avec le préfixe du navigateur -ms-.

1
::backdrop
selector
Estimated overall support.
96%

Browsers on computers :

Mobile browsers :

Outdated or marginal browsers :

Internet Explorer

KaiOS Browser

Samsung Internet

Androïd Brower

Chrome pour Androïd

Baidu Browser

QQ Browser

Safari

Safari sur IOS

Chrome

Edge

Firefox

Opéra

Opéra Mobile

UC Browser pour Androïd

Firefox pour Androïd

Opéra mini

See also: display state pseudo-classes.

The pseudo-classes below allow you to designate an element according to its display mode: full-screen, in a separate window, etc.

::backdrop
A pseudo-element targeting the element added by browsers behind dialog boxes or elements displayed in full screen.
:closed
Langue française
A pseudo-class that targets an element that can be either opened or closed (such as a select menu), and that is in the closed state.
::details-content
Langue française
This pseudo-element targets the detailed content of a details tag.
::part()
Langue française
Pseudo-element that targets a sub-element in the page's shadow tree (created by template).
:fullscreen
Langue française
A pseudo-class designating elements displayed in full screen during the time they are displayed in full screen.
:modal
Langue française
Pseudo-class designating elements displayed in modal: which block interactions with other elements.
:open
Langue française
A pseudo-class that targets elements that can be either opened or closed (such as select), and that are in the open state.
:picture-in-picture
Langue française
A pseudo class designating an element (most often a video) displayed in a window that does not scroll with the rest of the page.
:popover-open
Langue française
Pseudo-class that targets popover elements that are in the open (or visible) state.