aboutsummaryrefslogtreecommitdiff
path: root/files/ca/web/html/element/tbody/index.html
blob: 1fae0638a3130c64bc369e3372df7c0e098f8a47 (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
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
---
title: <tbody>
slug: Web/HTML/Element/tbody
tags:
  - Element
  - HTML
  - HTML tabular data
  - Reference
  - Tables
  - Web
translation_of: Web/HTML/Element/tbody
---
<p dir="ltr" style="margin-top: 0pt; margin-bottom: 0pt; line-height: 1.38;">L'<strong>Element HTML Cos de la Taula (<code>&lt;tbody&gt;</code>) </strong>defineix un o més elements {{HTMLElement ("tr")}} de dades de fileres que dona cos a l'element {{ HTMLElement("table") }} que és el seu pare  (si no hi ha altres elements, els elements &lt;tr&gt; són fills immediats d'aquest element taula.) en combinació de si hi ha elements que puguin precedir com {{ HTMLElement("thead") }} i/o {{ HTMLElement("tfoot") }}, &lt;tbody&gt; proporciona informació semàntica  addicional per a dispositius com ara impressores i pantalles. D'els elements fills de la taula pare, &lt;tbody&gt; representa el contingut en el cual, quan més llarg sigui d'una pàgina, més probable serà que difereixi per a cada pàgina impresa; mentre que el contingut de {{HTMLElement ("thead")}} i {{HTMLElement ("tfoot")}} serà el mateixa o semblant per a cada pàgina impresa. Com a mostra, &lt;tbody&gt; permetrà el desplaçament independent dels elements {{ HTMLElement("thead") }}, {{ HTMLElement("tfoot") }} i {{ HTMLElement("caption") }} del mateixa element pare {{ HTMLElement("table") }}. Recordeu que a diferència dels elements &lt;thead&gt;, &lt;tfoot&gt; i &lt;caption&gt;, múltiples elements <code>&lt;tbody&gt;</code> són acceptats (si consecutiu), permetent que les files de dades de taules llargues puguin ser dividides en diferents seccions, cadascuna amb un format separat si és necessari.</p>

<p dir="ltr" style="margin-top: 0pt; margin-bottom: 0pt; line-height: 1.38;"> </p>

<h2 id="Context_d'ùs">Context d'ùs</h2>

<table class="standard-table">
 <tbody>
  <tr>
   <td><a href="/en/HTML/Content_categories" title="en/HTML/Content categories">Categories de contingut</a></td>
   <td>Cap.</td>
  </tr>
  <tr>
   <td>Contingut permès</td>
   <td>Zero o més elements {{ HTMLElement("tr") }}.</td>
  </tr>
  <tr>
   <td>Omissió de l'etiqueta</td>
   <td>L'element {{ HTMLElement("tbody") }} no és un element fill obligatori per a un element pare {{ HTMLElement("table") }} com a representació gràfica. No obstant això, no ha d'estar present, si  l'element pare {{ HTMLElement("table") }} té un element {{ HTMLElement("tr") }} com a fill.</td>
  </tr>
  <tr>
   <td>Elements pares permesos</td>
   <td>Dins de l'element pare obligatori {{ HTMLElement("table") }}, l'element {{HTMLElement ("tbody")}} es pot afegir després d'un element {{ HTMLElement("caption") }}, {{HTMLElement("colgroup") }}, {{ HTMLElement("thead") }} i {{ HTMLElement("tfoot") }}.</td>
  </tr>
  <tr>
   <td>Normativa del document</td>
   <td><a class="external" href="http://www.whatwg.org/specs/web-apps/current-work/multipage/tabular-data.html#the-tbody-element" rel="external nofollow" title="http://www.whatwg.org/specs/web-apps/current-work/multipage/tabular-data.html#the-tbody-element">HTML5, secció 4.9.5</a> (<a class="external" href="http://www.w3.org/TR/REC-html40/struct/tables.html#h-11.2.3" title="http://www.w3.org/TR/REC-html40/struct/tables.html#h-11.2.3">HTML4.01, secció 11.2.3</a>)</td>
  </tr>
 </tbody>
</table>

<h2 id="Atributs">Atributs</h2>

<p>Aquest element inclou els<span style="line-height: 21px;"> </span><a href="https://developer.mozilla.org/en-US/docs/HTML/Global_attributes" style="line-height: 21px;" title="HTML/Global attributes">atributs globals</a><span style="line-height: 21px;">.</span></p>

<dl>
 <dt>{{ htmlattrdef("align") }} {{ Deprecated_inline() }} in {{ HTMLVersionInline(4.01) }}, {{ obsolete_inline() }} in {{ HTMLVersionInline(5) }}</dt>
 <dd>Aquest atribut enumerat especifica com s'aplicarà l'alineació horitzontal del contingut de cada cel·la. Els valors possibles són:
 <ul>
  <li><span style="font-family: courier new;">left</span>, <span class="short_text" id="result_box" lang="ca"><span>alinea el</span> <span>contingut</span> <span>a l'esquerra</span> <span>de la cel·la</span></span></li>
  <li><span style="font-family: courier new;">center</span>, centra el contingut de la cel·la</li>
  <li><span style="font-family: courier new;">right</span>, <span class="short_text" id="result_box" lang="ca"><span>alinea el</span> <span>contingut</span> <span>a la dreta</span> <span>de la cel·la</span></span></li>
  <li><span style="font-family: courier new;">justify</span>, inserta espais en el contingut textual de manera que el contingut es justifica en la cel·la</li>
  <li><span style="font-family: courier new;">char</span>, alinea el contingut textual en un caràcter especial amb una desplaçament mínima definit per els atributs {{ htmlattrxref("char", "tbody") }} i {{ htmlattrxref("charoff", "tbody") }}.</li>
 </ul>

 <p>Si aquest atribut no està establert, el valor assumit és <code>left</code>.</p>

 <div class="note"><strong>Nota: </strong>No utilitzeu aquest atribut, ja que és obsolet (no suportat) en l'últim estàndard.

 <ul>
  <li>Per aconseguir el mateix efecte que els valors <span style="font-family: courier new;">left</span>, <span style="font-family: courier new;">center</span>, <span style="font-family: courier new;">right</span> or <span style="font-family: courier new;">justify</span> utilitzeu la propietat CSS {{ cssxref("text-align") }}.</li>
  <li>Per aconseguir el mateix efecte que el valor <code>char</code>, en CSS3, podeu utilitzar el valor de {{htmlattrxref ("char", "tbody")}} com el valor de la propietat {{ cssxref("text-align") }} {{ unimplemented_inline() }}.</li>
 </ul>
 </div>
 </dd>
</dl>

<dl>
 <dt>{{ htmlattrdef("bgcolor") }} {{ Non-standard_inline() }}</dt>
 <dd>Aquest atribut defineix el color de fons de cada cel·la de la columna. És un codi hexadecimal de 6 dígits com es defineix en <a class="external" href="http://www.w3.org/Graphics/Color/sRGB" title="http://www.w3.org/Graphics/Color/sRGB">sRGB</a>, prefixat per un '#'. Podeu utilitzar una de les setze cadenes de color predefinits:
 <table style="width: 80%;">
  <tbody>
   <tr>
    <td style="background-color: black; width: 24px; height: 24px; border-width: 1px; border-color: black; border-style: solid;"> </td>
    <td><span style="font-family: courier new;">black</span> = "#000000"</td>
    <td style="background-color: green; width: 24px; height: 24px; border-width: 1px; border-color: black; border-style: solid;"> </td>
    <td><span style="font-family: courier new;">green</span> = "#008000"</td>
   </tr>
   <tr>
    <td style="background-color: silver; width: 24px; height: 24px; border-width: 1px; border-color: black; border-style: solid;"> </td>
    <td><span style="font-family: courier new;">silver</span> = "#C0C0C0"</td>
    <td style="background-color: lime; width: 24px; height: 24px; border-width: 1px; border-color: black; border-style: solid;"> </td>
    <td><span style="font-family: courier new;">lime</span> = "#00FF00"</td>
   </tr>
   <tr>
    <td style="background-color: gray; width: 24px; height: 24px; border-width: 1px; border-color: black; border-style: solid;"> </td>
    <td><span style="font-family: courier new;">gray</span> = "#808080"</td>
    <td style="background-color: olive; width: 24px; height: 24px; border-width: 1px; border-color: black; border-style: solid;"> </td>
    <td><span style="font-family: courier new;">olive</span> = "#808000"</td>
   </tr>
   <tr>
    <td style="background-color: white; width: 24px; height: 24px; border-width: 1px; border-color: black; border-style: solid;"> </td>
    <td><span style="font-family: courier new;">white</span> = "#FFFFFF"</td>
    <td style="background-color: yellow; width: 24px; height: 24px; border-width: 1px; border-color: black; border-style: solid;"> </td>
    <td><span style="font-family: courier new;">yellow</span> = "#FFFF00"</td>
   </tr>
   <tr>
    <td style="background-color: maroon; width: 24px; height: 24px; border-width: 1px; border-color: black; border-style: solid;"> </td>
    <td><span style="font-family: courier new;">maroon</span> = "#800000"</td>
    <td style="background-color: navy; width: 24px; height: 24px; border-width: 1px; border-color: black; border-style: solid;"> </td>
    <td><span style="font-family: courier new;">navy</span> = "#000080"</td>
   </tr>
   <tr>
    <td style="background-color: red; width: 24px; height: 24px; border-width: 1px; border-color: black; border-style: solid;"> </td>
    <td><span style="font-family: courier new;">red</span> = "#FF0000"</td>
    <td style="background-color: blue; width: 24px; height: 24px; border-width: 1px; border-color: black; border-style: solid;"> </td>
    <td><span style="font-family: courier new;">blue</span> = "#0000FF"</td>
   </tr>
   <tr>
    <td style="background-color: purple; width: 24px; height: 24px; border-width: 1px; border-color: black; border-style: solid;"> </td>
    <td><span style="font-family: courier new;">purple</span> = "#800080"</td>
    <td style="background-color: teal; width: 24px; height: 24px; border-width: 1px; border-color: black; border-style: solid;"> </td>
    <td><span style="font-family: courier new;">teal</span> = "#008080"</td>
   </tr>
   <tr>
    <td style="background-color: fuchsia; width: 24px; height: 24px; border-width: 1px; border-color: black; border-style: solid;"> </td>
    <td><span style="font-family: courier new;">fuchsia</span> = "#FF00FF"</td>
    <td style="background-color: aqua; width: 24px; height: 24px; border-width: 1px; border-color: black; border-style: solid;"> </td>
    <td><span style="font-family: courier new;">aqua</span> = "#00FFFF"</td>
   </tr>
  </tbody>
 </table>

 <div class="note"><strong>Nota d'ùs: </strong>No utilitzeu aquest atribut, ja que no és estàndard i només s'executa en algunes versions de Microsoft Internet Explorer: l'element {{ HTMLElement("tbody") }} se li ha de donar estil amb <a href="https://developer.mozilla.org/en/CSS" title="en/CSS">CSS</a> . Per donar un efecte similar a l'atribut bgcolor, utilitzeu la propietat <a href="https://developer.mozilla.org/en/CSS" title="en/CSS">CSS</a> {{cssxref ("background-color") }}, en els elements corresponents {{ HTMLElement("td") }} o {{ HTMLElement("th") }}.</div>
 </dd>
</dl>

<dl>
 <dt>{{ htmlattrdef("char") }} {{ Deprecated_inline() }} in {{ HTMLVersionInline(4.01) }}, {{ obsolete_inline() }} in {{ HTMLVersionInline(5) }}</dt>
 <dd>Aquest atribut s'utilitza per establir el caràcter per alinear les cel·les d'una columna. Els valors típics d'això inclouen un punt (.) en intentar alinear els números o valors monetaris. Si {{ htmlattrxref("align", "tbody") }} no està establert a <code>char</code>, aquest atribut s'ignora.
 <div class="note"><strong>Nota: </strong>No utilitzeu aquest atribut, ja que és obsolet (i no està suportat) en l'últim estàndard. Per aconseguir el mateix efecte que {{htmlattrxref("char", "tbody") }} , en CSS3, podeu utilitzar el joc de caràcters utilitzant l'atribut {{htmlattrxref("char", "tbody") }} com el valor de la propietat {{cssxref ("text-align") }} {{unimplemented_inline() }}.</div>
 </dd>
</dl>

<dl>
 <dt>{{ htmlattrdef("charoff") }} {{ Deprecated_inline() }} in {{ HTMLVersionInline(4.01) }}, {{ obsolete_inline() }} in {{ HTMLVersionInline(5) }}</dt>
 <dd>Aquest atribut s'utilitza per indicar el nombre de caràcters a desplaçar de les dades de la columna dels caràcters d'alineació especificats per l'atribut <code>char</code>.
 <div class="note"><strong>Nota: </strong>No utilitzeu aquest atribut, ja que és obsolet (i no està suportat) en l'últim estàndard.</div>
 </dd>
</dl>

<dl>
 <dt>{{ htmlattrdef("valign") }} {{ Deprecated_inline() }} in {{ HTMLVersionInline(4.01) }}, {{ obsolete_inline() }} in {{ HTMLVersionInline(5) }}</dt>
 <dd>Aquest atribut especifica l'alineació vertical del text dins de cada fila de cel·les de la capçalera de la taula. Els valors possibles per aquest atribut són:
 <ul>
  <li><span style="font-family: courier new;">baseline</span>, posarà el text tan a prop de la part inferior de la cel·la com sigui possible, però alineant-ho en la <a href="http://en.wikipedia.org/wiki/Baseline_%28typography%29">línia de base (</a><a class="external" href="http://en.wikipedia.org/wiki/Baseline_%28typography%29" title="http://en.wikipedia.org/wiki/Baseline_(typography)">baseline)</a> dels caràcters en lloc de la part inferior d'ells. Si els caràcters són tots de la mida, això té el mateix efecte que <span style="font-family: courier new;">bottom</span>.</li>
  <li><span style="font-family: courier new;">bottom</span>, posarà el text tan a prop de la part inferior de la cel·la com sigui possible;</li>
  <li><span style="font-family: courier new;">middle</span>, centra el text en la cel·la;</li>
  <li>i <span style="font-family: courier new;">top</span>, posarà el text tant a prop de la part superior de la cel·la com sigui possible.</li>
 </ul>

 <div class="note"><strong>Nota: </strong> No utilitzeu aquest atribut, ja que és obsolet (i no està suportat) en l'últim estàndard : en el seu lloc aplicar la propietat CSS {{cssxref ("vertical-align")}}.</div>
 </dd>
</dl>

<h2 id="Interfície_DOM">Interfície DOM</h2>

<p>Aquest element implementa la interfície <code><a href="/en-US/docs/Web/API/HTMLTableSectionElement" title="Documentation for HTMLTableSectionElement">HTMLTableSectionElement</a></code>.</p>

<h2 id="Exemples">Exemples</h2>

<p>Si us plau, veure la pàgina {{ HTMLElement("table") }} per exemples de <code>&lt;tbody&gt;</code>.</p>

<h2 id="Navegadors_compatibles">Navegadors compatibles</h2>

<p>{{ CompatibilityTable() }}</p>

<div id="compat-desktop">
<table class="compat-table">
 <tbody>
  <tr>
   <th>Característica</th>
   <th>Chrome</th>
   <th>Firefox (Gecko)</th>
   <th>Internet Explorer</th>
   <th>Opera</th>
   <th>Safari</th>
  </tr>
  <tr>
   <td>Suport bàsic</td>
   <td>1.0</td>
   <td>{{ CompatGeckoDesktop("1.0") }}</td>
   <td>{{ CompatVersionUnknown() }}</td>
   <td>{{ CompatVersionUnknown() }}</td>
   <td>{{ CompatVersionUnknown() }}</td>
  </tr>
  <tr>
   <td>atribut <code>align/valign</code></td>
   <td>1.0</td>
   <td>{{ CompatNo() }} [1]</td>
   <td>{{ CompatVersionUnknown() }}</td>
   <td>{{ CompatVersionUnknown() }}</td>
   <td>{{ CompatVersionUnknown() }}</td>
  </tr>
  <tr>
   <td>atribut <code>char/charoff</code></td>
   <td>1.0</td>
   <td>{{ CompatNo() }} [2]</td>
   <td>{{ CompatVersionUnknown() }}</td>
   <td>{{ CompatVersionUnknown() }}</td>
   <td>{{ CompatVersionUnknown() }}</td>
  </tr>
  <tr>
   <td>atribut <code>bgcolor</code> {{ Non-standard_inline() }}</td>
   <td>{{ CompatNo() }}</td>
   <td>{{ CompatNo() }}</td>
   <td>{{ CompatVersionUnknown() }}</td>
   <td>{{ CompatNo() }}</td>
   <td>{{ CompatNo() }}</td>
  </tr>
 </tbody>
</table>
</div>

<div id="compat-mobile">
<table class="compat-table">
 <tbody>
  <tr>
   <th>Característica</th>
   <th>Android</th>
   <th>Firefox Mobile (Gecko)</th>
   <th>IE Mobile</th>
   <th>Opera Mobile</th>
   <th>Safari Mobile</th>
  </tr>
  <tr>
   <td>Suport bàsic</td>
   <td>{{ CompatVersionUnknown() }}</td>
   <td>{{ CompatGeckoMobile("1.0") }}</td>
   <td>{{ CompatVersionUnknown() }}</td>
   <td>{{ CompatVersionUnknown() }}</td>
   <td>{{ CompatVersionUnknown() }}</td>
  </tr>
  <tr>
   <td>atribut <code>align/valign</code></td>
   <td>{{ CompatUnknown() }}</td>
   <td>{{ CompatNo() }} [1]</td>
   <td>{{ CompatUnknown() }}</td>
   <td>{{ CompatUnknown() }}</td>
   <td>{{ CompatUnknown() }}</td>
  </tr>
  <tr>
   <td>atribut <code>char/charoff</code></td>
   <td>{{ CompatUnknown() }}</td>
   <td>{{ CompatNo() }} [2]</td>
   <td>{{ CompatUnknown() }}</td>
   <td>{{ CompatUnknown() }}</td>
   <td>{{ CompatUnknown() }}</td>
  </tr>
  <tr>
   <td>atribut <code>bgcolor</code> {{ Non-standard_inline() }}</td>
   <td>{{ CompatNo() }}</td>
   <td>{{ CompatNo() }}</td>
   <td>{{ CompatVersionUnknown() }}</td>
   <td>{{ CompatNo() }}</td>
   <td>{{ CompatNo() }}</td>
  </tr>
 </tbody>
</table>
</div>

<p>[1] Veure {{bug(915)}}.</p>

<p>[2] Veure {{bug(2212)}}.</p>

<h2 id="Veure">Veure</h2>

<ul>
 <li>Altres elements HTML relacionats amb taules: {{ HTMLElement("caption") }}, {{ HTMLElement("col") }}, {{ HTMLElement("colgroup") }}, {{ HTMLElement("table") }}, {{ HTMLElement("td") }}, {{ HTMLElement("tfoot") }}, {{ HTMLElement("th") }}, {{ HTMLElement("thead") }}, {{ HTMLElement("tr") }};</li>
 <li>Les propietats CSS i pseudo-classes poden ser especialment útils per donar estil a l'element <code>&lt;tbody&gt;</code>:
  <ul>
   <li>la pseudo-classe {{cssxref (":nth-child")}} per aplicar l'alineació de les cel·les en la columna;</li>
   <li>La propietat {{cssxref ("text-align")}} per alinear el contingut de totes les cel·les en el mateix caràcter, com '.'.</li>
  </ul>
 </li>
</ul>

<p>{{HTMLRef}}</p>