aboutsummaryrefslogtreecommitdiff
path: root/files/pt-br/web/css/visibility/index.html
blob: a0bdbdc31f4d248b455efa1db58f3d87e9317cb0 (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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
---
title: visibility
slug: Web/CSS/visibility
translation_of: Web/CSS/visibility
---
<div>{{CSSRef}}</div>

<p><span id="result_box" lang="pt"><span>A propriedade CSS de visibilidade pode mostrar ou ocultar um elemento sem afetar o layout de um documento (ou seja, o espaço é criado para elementos independentemente de serem visíveis ou não).</span> <span>A propriedade também pode ocultar linhas ou colunas em um</span></span> {{HTMLElement("table")}}.</p>

<pre class="brush: css no-line-numbers">/* palavra-chave valores */
visibility: visible;
visibility: hidden;
visibility: collapse;

/* Global values */
visibility: inherit;
visibility: initial;
visibility: unset;
</pre>

<div class="note">
<p><strong>Nota:</strong>  Para ocultar um elemento ou removê-lo do layout do documento, defina a propriedade {{cssxref("display")}}  como <code>none</code> em vez de usar <code>visibility</code>.</p>
</div>

<p>{{cssinfo}}</p>

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

<p><span id="result_box" lang="pt"><span>A propriedade é especificada como um dos valores das palavras-chave listados abaixo.</span></span></p>

<h3 id="Valores">Valores</h3>

<dl>
 <dt><code>visible</code></dt>
 <dd>The element box is visible.</dd>
 <dt><code>hidden</code></dt>
 <dd>The element box is invisible (not drawn), but still affects layout as normal. Descendants of the element will be visible if they have <code>visibility</code> set to <code>visible</code>. The element cannot receive focus (such as when navigating through <a href="/en-US/docs/Web/HTML/Global_attributes/tabindex">tab indexes</a>).</dd>
 <dt><code>collapse</code></dt>
 <dd>
 <ul>
  <li>For {{HTMLElement("table")}} rows, columns, column groups, and row groups, the row(s) or column(s) are hidden and the space they would have occupied is removed (as if <code>{{Cssxref("display")}}: none</code> were applied to the column/row of the table). However, the size of other rows and columns is still calculated as though the cells in the collapsed row(s) or column(s) are present. This value allows for the fast removal of a row or column from a table without forcing the recalculation of widths and heights for the entire table.</li>
  <li>For <a href="/en-US/docs/Mozilla/Tech/XUL">XUL</a> elements, the computed size of the element is always zero, regardless of other styles that would normally affect the size, although margins still take effect.</li>
  <li>For other elements, <code>collapse</code> is treated the same as <code>hidden</code>.</li>
 </ul>
 </dd>
</dl>

<h3 id="Formal_syntax">Formal syntax</h3>

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

<h2 id="Interpolação">Interpolação</h2>

<p>Visibility values are interpolable between <em>visible</em> and <em>not-visible</em>. One of the start or ending values must therefore be <code>visible</code> or no interpolation can happen. The value is interpolated as a discrete step, where values of the timing function between <code>0</code> and <code>1</code> map to <code class="css">visible</code> and other values of the timing function (which occur only at the start/end of the transition or as a result of <code class="css">cubic-bezier()</code> functions with y values outside of [0, 1]) map to the closer endpoint.</p>

<h2 id="Exemplos">Exemplos</h2>

<h3 id="Exemplo_básico">Exemplo básico</h3>

<h4 id="HTML">HTML</h4>

<pre class="brush: html">&lt;p class="visible"&gt;The first paragraph is visible.&lt;/p&gt;
&lt;p class="not-visible"&gt;The second paragraph is NOT visible.&lt;/p&gt;
&lt;p class="visible"&gt;The third paragraph is visible. Notice the second paragraph is still occupying space.&lt;/p&gt;
</pre>

<h4 id="CSS">CSS</h4>

<pre class="brush: css">.visible {
  visibility: visible;
}

.not-visible {
  visibility: hidden;
}
</pre>

<p>{{EmbedLiveSample('Basic_example')}}</p>

<h3 id="Table_example">Table example</h3>

<h4 id="HTML_2">HTML</h4>

<pre class="brush: html">&lt;table&gt;
  &lt;tr&gt;
    &lt;td&gt;1.1&lt;/td&gt;
    &lt;td class="collapse"&gt;1.2&lt;/td&gt;
    &lt;td&gt;1.3&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr class="collapse"&gt;
    &lt;td&gt;2.1&lt;/td&gt;
    &lt;td&gt;2.2&lt;/td&gt;
    &lt;td&gt;2.3&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td&gt;3.1&lt;/td&gt;
    &lt;td&gt;3.2&lt;/td&gt;
    &lt;td&gt;3.3&lt;/td&gt;
  &lt;/tr&gt;
&lt;/table&gt;</pre>

<h4 id="CSS_2">CSS</h4>

<pre class="brush: css">.collapse {
  visibility: collapse;
}

table {
  border: 1px solid red;
}

td {
  border: 1px solid gray;
}
</pre>

<p>{{EmbedLiveSample('Table_example')}}</p>

<h2 id="Notas">Notas</h2>

<ul>
 <li>Support for <code>visibility: collapse</code> is missing or partially incorrect in some modern browsers. It may not be correctly treated like <code>visibility: hidden</code> on elements other than table rows and columns.</li>
 <li><code>visibility: collapse</code> may change the layout of a table if the table has nested tables within the cells that are collapsed, unless <code>visibility: visible</code> is specified explicitly on nested tables.</li>
</ul>

<h2 id="Especificações">Especificações</h2>

<table class="standard-table">
 <thead>
  <tr>
   <th scope="col">Especificações</th>
   <th scope="col">Status</th>
   <th scope="col">Comentários</th>
  </tr>
 </thead>
 <tbody>
  <tr>
   <td>{{SpecName('CSS3 Flexbox', '#visibility-collapse', 'visibility')}}</td>
   <td>{{Spec2('CSS3 Flexbox')}}</td>
   <td>Defines the <code>collapse</code> value as it applies to flex items.</td>
  </tr>
  <tr>
   <td>{{SpecName('CSS3 Box', '#visibility-prop', 'visibility')}}</td>
   <td>{{Spec2('CSS3 Box')}}</td>
   <td>Nenhuma alteração.</td>
  </tr>
  <tr>
   <td>{{SpecName('CSS3 Transitions', '#animatable-css', 'visibility')}}</td>
   <td>{{Spec2('CSS3 Transitions')}}</td>
   <td>Defines <code>visibility</code> as animatable.</td>
  </tr>
  <tr>
   <td>{{SpecName('CSS2.1', 'visufx.html#visibility', 'visibility')}}</td>
   <td>{{Spec2('CSS2.1')}}</td>
   <td>Definição inicial.</td>
  </tr>
 </tbody>
</table>

<h2 id="Compatibilidade_entre_browsers">Compatibilidade entre browsers</h2>

<p> </p>



<p>{{Compat("css.properties.visibility")}}</p>

<p> </p>