The _:-webkit-full-screen hack

Last updated 2016-01-12.

The hack

_:-webkit-full-screen, .your-selector-here {
  /* your declarations here */
}

Based upon related hacks by Jeff Clayton (source)

Live testcase

Affected
Unaffected

If the square above shows the word "Affected", then your browser supports this hack.

How it works

The underscore is a tag selector that selects <_> elements, which is to say elements whose tagName is "_" (as opposed to e.g. "div"). Of course, HTML doesn't define any <_> element, so this won't match anything, thus preventing this CSS rule from affecting anything besides .your-selector-here.

:-webkit-full-screen is WebKit's prefixed version of the standardized :fullscreen pseudo-class, which matches whenever its element is being displayed in full-screen mode using the WHATWG Fullscreen API. Since Chrome uses Blink, which was forked from WebKit, Chrome also recognizes :-webkit-full-screen. MS Edge has also implemented :-webkit-full-screen for compatibility reasons, despite not having WebKit heritage. As of 2016-01-12, Firefox has refrained from implementing this pseudo-class, though they have been known to implement other WebKit-prefixed CSS entities for compatibility reasons. As of 2016-01-12, for unknown reasons (security or usability perhaps?), Apple has continued to keep support for :-webkit-full-screen disabled on iOS. When browsers see a CSS selector with a pseudo-element they don't recognize, they drop the entire CSS rule associated with it. Thus, only some browsers consider the selector valid and continue parsing it.

Affected browsers

Check out the links for corroborating screenshots.

Test results
Chrome
OS X Safari
iOS Safari
Firefox
Microsoft Edge
Internet Explorer
Chrome OS X
Safari
iOS
Safari
Firefox MS Edge1 Internet
Explorer
48
Unknown
10
Unknown
9.3
Unknown
46
Unknown
13
Unknown
47
Affected
9.0.2
Affected
9.2
Unaffected
45.0a2
Unaffected
12.10240
Affected
11
Unaffected
46
Affected
8.0.8
Affected
8.4
Unaffected
44.0b7
Unaffected
12.10166
Unknown
10
Unaffected
26
Affected
7.1.7
Affected
7.1
Unaffected
43.0.4
Unaffected
9
Unaffected
25
Unknown
6.2.7
Affected
6.1
Unaffected
4.0.1
Unaffected
8
Unaffected
5.1.7
Affected
5.1
Unaffected
7
Unknown
4
Unknown
4.3.5
Unknown
Note 1: MS Edge versions refer to the EdgeHTML rendering engine version, not the Edge app version shown in Edge's "About" screen. See this Can I Use issue.