diff options
| author | Peter Bengtsson <mail@peterbe.com> | 2020-12-08 14:40:17 -0500 |
|---|---|---|
| committer | Peter Bengtsson <mail@peterbe.com> | 2020-12-08 14:40:17 -0500 |
| commit | 33058f2b292b3a581333bdfb21b8f671898c5060 (patch) | |
| tree | 51c3e392513ec574331b2d3f85c394445ea803c6 /files/zh-cn/web/css/_colon_fullscreen | |
| parent | 8b66d724f7caf0157093fb09cfec8fbd0c6ad50a (diff) | |
| download | translated-content-33058f2b292b3a581333bdfb21b8f671898c5060.tar.gz translated-content-33058f2b292b3a581333bdfb21b8f671898c5060.tar.bz2 translated-content-33058f2b292b3a581333bdfb21b8f671898c5060.zip | |
initial commit
Diffstat (limited to 'files/zh-cn/web/css/_colon_fullscreen')
| -rw-r--r-- | files/zh-cn/web/css/_colon_fullscreen/index.html | 244 |
1 files changed, 244 insertions, 0 deletions
diff --git a/files/zh-cn/web/css/_colon_fullscreen/index.html b/files/zh-cn/web/css/_colon_fullscreen/index.html new file mode 100644 index 0000000000..fb793fa109 --- /dev/null +++ b/files/zh-cn/web/css/_colon_fullscreen/index.html @@ -0,0 +1,244 @@ +--- +title: ':fullscreen' +slug: 'Web/CSS/:fullscreen' +tags: + - CSS + - CSS Pseudo-class + - Experimental + - Full-screen + - Reference +translation_of: 'Web/CSS/:fullscreen' +--- +<div>{{CSSRef}}{{SeeCompatTable}}</div> + +<h2 id="总结">总结</h2> + +<p><code><font face="Open Sans, Arial, sans-serif">css伪类</font>:fullscreen应用于当前处于全屏显示模式的元素。</code> 它不仅仅选择顶级元素,还包括所有已显示的栈内元素。</p> + +<div class="note">W3C标准使用不带破折号的单词:fullscreen,但Webkit和Gecko应用接口各自使用前缀带有破折号的变量:<code>:-webkit-full-screen</code> 和<code>:-moz-full-screen。</code>微软的Edge和Internet Explorer各自使用标准语法:<code>:fullscreen</code>和<code>:-ms-fullscreen。</code></div> + +<h2 id="语法">语法</h2> + +<pre class="syntaxbox">{{csssyntax}}</pre> + +<h2 id="例子">例子</h2> + +<h3 id="HTML">HTML</h3> + +<pre class="brush: html"><div id="fullscreen"> + <h1>:fullscreen Demo</h1> + <p> This will become a big red text when on fullscreen.</p> + <button id="fullscreen-button">Enter Fullscreen</button> +</div> +</pre> + +<div class="hidden"> +<h3 id="Javascript">Javascript</h3> + +<pre class="brush: js">var fullscreenButton = document.getElementById("fullscreen-button"); +var fullscreenDiv = document.getElementById("fullscreen"); +var fullscreenFunc = fullscreenDiv.requestFullscreen; +if (!fullscreenFunc) { + ['mozRequestFullScreen', + 'msRequestFullscreen', + 'webkitRequestFullScreen'].forEach(function (req) { + fullscreenFunc = fullscreenFunc || fullscreenDiv[req]; + }); +} +function enterFullscreen() { + fullscreenFunc.call(fullscreenDiv); +} +fullscreenButton.addEventListener('click', enterFullscreen); +</pre> + +<h3 id="Browser-Specific_CSS">Browser-Specific CSS</h3> + +<pre class="brush: css">#fullscreen:-moz-full-screen { + padding: 42px; + background-color: pink; + border:2px solid #f00; + font-size: 200%; +} +#fullscreen:-ms-fullscreen { + padding: 42px; + background-color: pink; + border:2px solid #f00; + font-size: 200%; +} +#fullscreen:-webkit-full-screen { + padding: 42px; + background-color: pink; + border:2px solid #f00; + font-size: 200%; +} + +#fullscreen:-moz-full-screen > h1 { + color: red; +} +#fullscreen:-ms-fullscreen > h1 { + color: red; +} +#fullscreen:-webkit-full-screen > h1 { + color: red; +} + +#fullscreen:-moz-full-screen > p { + color: DarkRed; +} +#fullscreen:-ms-fullscreen > p { + color: DarkRed; +} +#fullscreen:-webkit-full-screen > p { + color: DarkRed; +} + +#fullscreen:-moz-full-screen > button { + display: none; +} +#fullscreen:-ms-fullscreen > button { + display: none; +} +#fullscreen:-webkit-full-screen > button { + display: none; +} +</pre> +</div> + +<h3 id="CSS">CSS</h3> + +<pre class="brush: css">#fullscreen:fullscreen { + padding: 42px; + background-color: pink; + border:2px solid #f00; + font-size: 200%; +} + +#fullscreen:fullscreen > h1 { + color: red; +} + +#fullscreen:fullscreen > p { + color: DarkRed; +} + +#fullscreen:fullscreen > button { + display: none; +} +</pre> + +<h3 id="结果">结果</h3> + +<p>{{ LiveSampleLink('Example', "(If the 'Enter Fullscreen' button doesn't work, try here)") }}</p> + +<p>{{ EmbedLiveSample('Example','80%','200px') }}</p> + +<h2 id="特点">特点</h2> + +<table class="standard-table"> + <thead> + <tr> + <th scope="col">特点</th> + <th scope="col">情况</th> + <th scope="col">评论</th> + </tr> + </thead> + <tbody> + <tr> + <td>{{SpecName('Fullscreen', '#:fullscreen-pseudo-class', ':fullscreen')}}</td> + <td>{{Spec2('Fullscreen')}}</td> + <td>Initial definition</td> + </tr> + </tbody> +</table> + +<h2 id="浏览器兼容性">浏览器兼容性</h2> + +<p>{{CompatibilityTable}}</p> + +<div id="compat-desktop"> +<table class="compat-table"> + <tbody> + <tr> + <th>特性</th> + <th>Chrome</th> + <th>Edge</th> + <th>Firefox (Gecko)</th> + <th>Internet Explorer</th> + <th>Opera</th> + <th>Safari</th> + </tr> + <tr> + <td> + <p>基本支持</p> + </td> + <td>15.0 {{property_prefix("-webkit")}}<sup>[1]</sup></td> + <td>12</td> + <td>{{CompatGeckoDesktop("9.0")}}{{property_prefix("-moz")}}<sup>[1]</sup><br> + {{CompatGeckoDesktop("47.0")}}<sup>[2]</sup></td> + <td>11 {{property_prefix("-ms")}}<sup>[3]</sup></td> + <td>{{CompatUnknown}}</td> + <td>6.0 {{property_prefix("-webkit")}}<sup>[1]</sup></td> + </tr> + <tr> + <td>全屏下选取所有元素</td> + <td>{{CompatUnknown}}</td> + <td>12</td> + <td>{{CompatGeckoDesktop(43)}}</td> + <td>11</td> + <td>{{CompatUnknown}}</td> + <td>{{CompatUnknown}}</td> + </tr> + </tbody> +</table> +</div> + +<div id="compat-mobile"> +<table class="compat-table"> + <tbody> + <tr> + <th>特性</th> + <th>Android</th> + <th>Firefox Mobile (Gecko)</th> + <th>IE Mobile</th> + <th>Opera Mobile</th> + <th>Safari Mobile</th> + </tr> + <tr> + <td>基本支持</td> + <td>{{CompatUnknown}}</td> + <td>{{CompatGeckoMobile("9.0")}}<br> + {{CompatGeckoDesktop("47.0")}}<sup>[2]</sup></td> + <td>{{CompatNo}}</td> + <td>{{CompatNo}}</td> + <td>{{CompatNo}}</td> + </tr> + <tr> + <td>全屏下选取所有元素</td> + <td>{{CompatUnknown}}</td> + <td>{{CompatGeckoMobile("43")}}</td> + <td>{{CompatUnknown}}</td> + <td>{{CompatUnknown}}</td> + <td>{{CompatUnknown}}</td> + </tr> + </tbody> +</table> +</div> + +<p>[1] Webkit和Gecko前缀版本在<em>full</em>和<em>screen</em>之间带有破折号, 但W3C标准使用一个单词:<code>:fullscreen</code>, <code>:-webkit-full-screen</code>, <code>:-moz-full-screen</code>.</p> + +<p>[2] Gecko 47.0 {{geckoRelease("47.0")}} 通过参数<code>full-screen-api.unprefix.enabled使用</code>不带前缀的伪类, 默认为false.</p> + +<p>[3] Internet Explorer使用前缀<code>-ms,但在</code><em>full</em>和<em>screen</em>之间没有破折号<code>:-ms-fullscreen</code>.</p> + +<h2 id="再看看">再看看</h2> + +<ul> + <li>{{cssxref("::backdrop")}}</li> + <li><a href="/en-US/docs/Web/API/Fullscreen_API">Using full-screen mode</a></li> + <li>{{ domxref("Element.requestFullscreen()") }}</li> + <li>{{ domxref("Document.exitFullscreen()") }}</li> + <li>{{ domxref("Document.fullscreen") }}</li> + <li>{{ domxref("Document.fullscreenElement") }}</li> + <li>{{HTMLAttrXRef("allowfullscreen", "iframe")}}</li> + <li>{{cssxref(":-moz-full-screen-ancestor")}}</li> +</ul> |
