aboutsummaryrefslogtreecommitdiff
path: root/files/pt-br/web/css/_colon_fullscreen/index.html
blob: 7d721684abeb6d40c2e968fc3ad94c367d9fe55a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
---
title: ':fullscreen'
slug: 'Web/CSS/:fullscreen'
translation_of: 'Web/CSS/:fullscreen'
---
<div>{{CSSRef}}</div>

<p><span class="seoSummary">A pseudo-classe <strong><code>:fullscreen</code></strong> do CSS representa os elementos que estão atualmente no modo tela-cheia. Se vários elementos estiverem em tela-cheia, isto seleciona todos.</span></p>

<h2 id="Sintaxe">Sintaxe</h2>

<pre class="syntaxbox notranslate">{{csssyntax}}</pre>

<h2 id="Usage_notes">Usage notes</h2>

<p>The <code>:fullscreen</code> pseudo-class lets you configure your stylesheets to automatically adjust the size, style, or layout of content when elements switch back and forth between full-screen and traditional presentations.</p>

<h2 id="Examples">Examples</h2>

<p>In this example, the color of a button is changed depending on whether or not the document is in full-screen mode. This is done without needing to specifically apply style changes using JavaScript.</p>

<h3 id="HTML">HTML</h3>

<p>The page's HTML looks like this:</p>

<pre class="brush: html notranslate">&lt;h1&gt;MDN Web Docs Demo: :fullscreen pseudo-class&lt;/h1&gt;

&lt;p&gt;This demo uses the &lt;code&gt;:fullscreen&lt;/code&gt; pseudo-class to automatically
  change the style of a button used to toggle full-screen mode on and off,
  entirely using CSS.&lt;/p&gt;

&lt;button id="fs-toggle"&gt;Toggle Fullscreen&lt;/button&gt;</pre>

<p>The {{HTMLElement("button")}} with the ID <code>"fs-toggle"</code> will change between pale red and pale green depending on whether or not the document is in full-screen mode.</p>

<h3 id="CSS">CSS</h3>

<p>The magic happens in the CSS. There are two rules here. The first establishes the background color of the "Toggle Full-screen Mode" button when the element is not in a full-screen state. The key is the use of the <code>:not(:fullscreen)</code>, which looks for the element to not have the <code>:fullscreen</code> pseudo-class applied to it.</p>

<pre class="brush: css notranslate">#fs-toggle:not(:fullscreen) {
  background-color: #afa;
}
</pre>

<p>When the document <em>is</em> in full-screen mode, the following CSS applies instead, setting the background color to a pale shade of red.</p>

<pre class="brush: css notranslate">#fs-toggle:fullscreen {
  background-color: #faa;
}</pre>

<h2 id="Specifications">Specifications</h2>

<table class="standard-table">
 <thead>
  <tr>
   <th scope="col">Specification</th>
   <th scope="col">Status</th>
   <th scope="col">Comment</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="Browser_compatibility">Browser compatibility</h2>

<div>


<p>{{Compat("css.selectors.fullscreen")}}</p>
</div>

<h2 id="See_also">See also</h2>

<ul>
 <li><a href="/en-US/docs/Web/API/Fullscreen_API">Fullscreen API </a></li>
 <li><a href="/en-US/docs/Web/API/Fullscreen_API/Guide">Guide to the Fullscreen API</a></li>
 <li>{{cssxref(":not")}}</li>
 <li>{{cssxref("::backdrop")}}</li>
 <li>DOM API: {{ domxref("Element.requestFullscreen()") }}, {{ domxref("Document.exitFullscreen()") }}, {{ domxref("Document.fullscreenElement") }}</li>
 <li>{{HTMLAttrXRef("allowfullscreen", "iframe")}} attribute</li>
</ul>