「ヘルプ:Tables」を編集中

移動先: 案内検索

警告: ログインしていません。編集を行うと、あなたの IP アドレスが公開されます。ログインまたはアカウントを作成すれば、あなたの編集はその利用者名とともに表示されるほか、その他の利点もあります。

この編集を取り消せます。 下記の差分を確認して、本当に取り消していいか検証してください。よろしければ変更を保存して取り消しを完了してください。
最新版 編集中の文章
1行目: 1行目:
<languages/>
+
{{PD Help Page}}
{{TNT|PD Help Page}}
+
:''For MediaWiki's database table structure, see: [[Manual:Database layout]]''
:''<translate><!--T:1-->
 
For MediaWiki's database table structure, see <tvar|1>{{ll|Manual:Database layout}}</></translate>''
 
  
<translate>
+
'''Tables''' may be authored in wiki pages using either XHTML table elements directly, or using wikicode formatting to define the table. XHTML table elements and their use are well described on various web pages and will not be discussed here. The benefit of wikicode is that the table is constructed of character symbols which tend to make it easier to perceive the table structure in the article editing view compared to XHTML table elements.
<!--T:2-->
+
'''Tables''' may be created in wiki pages.</translate>
+
As a general rule, it is best to avoid using a table unless you need one. Table markup often complicates page editing.
<translate>
 
<!--T:3-->
 
As a general rule, it is best to avoid using a table unless you need one.</translate>
 
<translate>
 
<!--T:4-->
 
Table markup often complicates page editing.</translate><ref><translate><!--T:5-->
 
Tables can be created using either XHTML table elements directly, or using wikicode formatting to define the table.</translate>
 
<translate>
 
<!--T:6-->
 
XHTML table elements and their use are well described on various web pages and will not be discussed here.</translate>
 
<translate>
 
<!--T:7-->
 
The benefit of wikicode is that the table is constructed of character symbols which tend to make it easier to perceive the table structure in the article editing view compared to XHTML table elements.</translate></ref>
 
  
<translate>
+
== Wiki table markup summary ==
== Wiki table markup summary == <!--T:8-->
+
{| class="wikitable" width="60%"
</translate>
 
{| class="wikitable" style="width:60%"
 
 
| style="padding: 10px;"| <big><nowiki>{|</nowiki></big>
 
| style="padding: 10px;"| <big><nowiki>{|</nowiki></big>
| style="padding: 5px;"| <translate><!--T:9-->
+
| style="padding: 5px;"| '''table start'''
'''table start''', ''required''</translate>
 
 
|-
 
|-
 
| style="padding: 10px;"| <big><nowiki>|+</nowiki></big>
 
| style="padding: 10px;"| <big><nowiki>|+</nowiki></big>
| style="padding: 5px;" | <translate><!--T:10-->
+
| style="padding: 5px;"| table '''caption,''' ''optional;'' only between '''table start''' and first '''table row'''
table '''caption''', ''optional;'' only between '''table start''' and '''table row'''</translate>
 
 
|-
 
|-
 
| style="padding: 10px;"| <big><nowiki>|-</nowiki></big>
 
| style="padding: 10px;"| <big><nowiki>|-</nowiki></big>
| style="padding: 5px;" | <translate><!--T:11-->
+
| style="padding: 5px;"| '''table row,''' ''optional on first row'' -- wiki engine assumes the first row
'''table row''', ''optional on first row''—wiki engine assumes the first row</translate>
 
 
|-
 
|-
 
| style="padding: 10px;"| <big><nowiki>!</nowiki></big>  
 
| style="padding: 10px;"| <big><nowiki>!</nowiki></big>  
| style="padding: 5px;" | <translate><!--T:12-->
+
| style="padding: 5px;"| '''table header''' cell, ''optional.'' Consecutive '''table header''' cells may be added on same line separated by double marks (<code>!!</code>) or start on new lines, each with its own single mark (<code>!</code>).
'''table header''' cell, ''optional.''</translate> <translate><!--T:13-->
 
Consecutive '''table header''' cells may be added on same line separated by double marks (<code>!!</code>) or start on new lines, each with its own single mark (<code>!</code>).</translate>
 
 
|-  
 
|-  
 
| style="padding: 10px;"| <big><nowiki>|</nowiki></big>
 
| style="padding: 10px;"| <big><nowiki>|</nowiki></big>
| style="padding: 5px;" | <translate><!--T:14-->
+
| style="padding: 5px;"| '''table data''' cell, ''required!'' Consecutive '''table data''' cells may be added on same line separated by double marks (<code><nowiki>||</nowiki></code>) or start on new lines, each with its own single mark (<code><nowiki>|</nowiki></code>).
'''table data''' cell, ''optional''.</translate> <translate><!--T:15-->
 
Consecutive '''table data''' cells may be added on same line separated by double marks (<code><nowiki>||</nowiki></code>) or start on new lines, each with its own single mark (<code><nowiki>|</nowiki></code>).</translate>
 
 
|-
 
|-
 
| style="padding: 10px;"| <big><nowiki>|}</nowiki></big>
 
| style="padding: 10px;"| <big><nowiki>|}</nowiki></big>
| style="padding: 5px;" | <translate><!--T:379-->
+
| style="padding: 5px;"| '''table end'''  
'''table end''', ''required''</translate>
 
 
|}
 
|}
<translate>
+
*The above marks must '''start on a new line''' except the double <code>||</code> and <code>!!</code> for optionally adding consecutive cells to a line. However, blank spaces at the beginning of a line are ignored.
<!--T:16-->
+
*'''XHTML attributes.''' Each mark, except table end, optionally accepts one or more XHTML attributes. Attributes must be on the same line as the mark. Separate attributes from each other with a single space.  
*The above marks must '''start on a new line''' except the double <code>||</code> and <code>!!</code> for optionally adding consecutive cells to a line. However, blank spaces at the beginning of a line are ignored.</translate>
+
**Cells and caption (<code>|</code> or <code>||</code>, <code>!</code> or <code>!!</code>, and <code>|+</code>) hold content. So separate any attributes from content with a single pipe (<code>|</code>). Cell content may follow on same line or on following lines.
*'''<translate><!--T:17-->
+
**Table and row marks (<code>{|</code> and <code>|-</code>) do not directly hold content. Do ''not'' add pipe (<code>|</code>) after their optional attributes. If you erroneously add a pipe after attributes for the table mark or row mark the parser will delete it ''and'' your final attribute if it was touching the erroneous pipe!
XHTML attributes.</translate>''' <translate><!--T:18-->
+
*'''Content''' may (a) follow its cell mark on the same line after any optional XHTML attributes or (b) on lines below the cell mark. Content that uses wiki markup that itself needs to start on a new line, such as lists, headings, or nested tables, must be on its own new line.
Each mark, except table end, optionally accepts one or more XHTML attributes.</translate> <translate><!--T:19-->
+
**'''Pipe character as content.''' To insert a pipe (<code>|</code>) character into a table use the &lt;nowiki&gt;<code>|</code>&lt;/nowiki&gt; escaping markup
Attributes must be on the same line as the mark.</translate> <translate><!--T:20-->
 
Separate attributes from each other with a single space.</translate>
 
<translate>
 
<!--T:21-->
 
**Cells and caption (<code>|</code> or <code>||</code>, <code>!</code> or <code>!!</code>, and <code>|+</code>) hold content.</translate> <translate><!--T:22-->
 
So separate any attributes from content with a single pipe (<code>|</code>).</translate> <translate><!--T:23-->
 
Cell content may follow on same line or on following lines.</translate>
 
<translate>
 
<!--T:24-->
 
**Table and row marks (<code>{|</code> and <code>|-</code>) do not directly hold content.</translate> <translate><!--T:25-->
 
Do ''not'' add pipe (<code>|</code>) after their optional attributes.</translate> <translate><!--T:26-->
 
If you erroneously add a pipe after attributes for the table mark or row mark the parser will delete it ''and'' your final attribute if it was touching the erroneous pipe!</translate>
 
<translate>
 
<!--T:27-->
 
*'''Content''' may (a) follow its cell mark on the same line after any optional XHTML attributes or (b) on lines below the cell mark.</translate> <translate><!--T:28-->
 
Content that uses wiki markup that itself needs to start on a new line, such as lists, headings, or nested tables, must be on its own new line.</translate>
 
<translate>
 
<!--T:29-->
 
**'''Pipe character as content.'''</translate> <translate><!--T:30-->
 
To insert a pipe (<code>|</code>) character into a table, use the &lt;nowiki&gt;<code>|</code>&lt;/nowiki&gt; escaping markup.</translate>
 
  
<translate>
+
==Basics==
==Basics== <!--T:31--></translate>
+
The following table lacks borders and good spacing but shows the simplest wiki markup table structure.
<translate>
 
<!--T:32-->
 
The following table lacks borders and good spacing but shows the simplest wiki markup table structure.</translate>
 
  
{| style="width:100%"
+
{| width="100%"
! style="width: 50%;"|<translate><!--T:404-->
+
! style="width: 50%;"|You type
You type</translate>
+
! style="width: 50%;"|You get
! style="width: 50%;"|<translate><!--T:405-->
 
You get</translate>
 
 
|-
 
|-
 
| style="padding: 5px;"|
 
| style="padding: 5px;"|
 
<pre>
 
<pre>
 
{|
 
{|
|<translate><!--T:33-->
+
|Orange
Orange</translate>
+
|Apple
|<translate><!--T:34-->
 
Apple</translate>
 
 
|-
 
|-
|<translate><!--T:35-->
+
|Bread
Bread</translate>
+
|Pie
|<translate><!--T:36-->
 
Pie</translate>
 
 
|-
 
|-
|<translate><!--T:37-->
+
|Butter
Butter</translate>
+
|Ice cream  
|<translate><!--T:38-->
 
Ice cream</translate>
 
 
|}
 
|}
 
</pre>
 
</pre>
 
| style="padding: 5px;"|
 
| style="padding: 5px;"|
{|
+
{| align="center"
|<translate><!--T:39-->
+
|Orange
Orange</translate>
+
|Apple
|<translate><!--T:40-->
 
Apple</translate>
 
 
|-
 
|-
|<translate><!--T:41-->
+
|Bread
Bread</translate>
+
|Pie
|<translate><!--T:42-->
 
Pie</translate>
 
 
|-
 
|-
|<translate><!--T:43-->
+
|Butter
Butter</translate>
+
|Ice cream  
|<translate><!--T:44-->
 
Ice cream</translate>
 
 
|}
 
|}
 
|}
 
|}
  
<translate>
+
The cells in the same row can be listed on one line separated by <code>||</code> (two pipe symbols). If the text in the cell contains a line break, use <code><nowiki><br/></nowiki></code> instead.
<!--T:45-->
 
The cells in the same row can be listed on one line separated by <code>||</code> (two pipe symbols).</translate>
 
<translate>
 
<!--T:46-->
 
If the text in the cell should contain a line break, use <tvar|br><code><nowiki><br /></nowiki></code></> instead.</translate>
 
  
{| style="width:100%"
+
{| width="100%"
! style="width: 50%;"|<translate><!--T:406-->
+
! style="width: 50%;"|You type
You type</translate>
+
! style="width: 50%;"|You get
! style="width: 50%;"|<translate><!--T:407-->
 
You get</translate>
 
 
|-
 
|-
 
| style="padding: 5px;"|
 
| style="padding: 5px;"|
 
<pre>
 
<pre>
 
{|
 
{|
|<translate><!--T:47-->
+
|Orange||Apple||more
Orange</translate>||<translate><!--T:392-->
 
Apple</translate>||<translate><!--T:393-->
 
more</translate>
 
 
|-
 
|-
|<translate><!--T:48-->
+
|Bread||Pie||more
Bread</translate>||<translate><!--T:394-->
 
Pie</translate>||<translate><!--T:395-->
 
more</translate>
 
 
|-
 
|-
|<translate><!--T:49-->
+
|Butter||Ice<br/>cream||and<br/>more
Butter</translate>||<translate><!--T:396-->
 
Ice<br />cream</translate>||<translate><!--T:403-->
 
and<br />more</translate>
 
 
|}
 
|}
 
</pre>
 
</pre>
 
| style="padding: 5px;"|
 
| style="padding: 5px;"|
{|
+
{| align="center"
|<translate><!--T:50-->
+
|Orange||Apple||more
Orange</translate>||<translate><!--T:397-->
 
Apple</translate>||<translate><!--T:398-->
 
more</translate>
 
 
|-
 
|-
|<translate><!--T:51-->
+
|Bread||Pie||more
Bread</translate>||<translate><!--T:399-->
 
Pie</translate>||<translate><!--T:400-->
 
more</translate>
 
 
|-
 
|-
|<translate><!--T:52-->
+
|Butter||Ice<br/>cream||and<br/>more
Butter</translate>||<translate><!--T:401-->
 
Ice<br />cream</translate>||<translate><!--T:402-->
 
and<br />more</translate>
 
 
|}
 
|}
 
|}
 
|}
  
<translate>
+
Extra spaces within cells in the wiki markup, as in the wiki markup below, do not affect the actual table rendering.
<!--T:53-->
 
Extra spaces within cells in the wiki markup, as in the wiki markup below, do not affect the actual table rendering.</translate>
 
  
{| style="width:100%"
+
{| width="100%"
! style="width: 50%;"|<translate><!--T:408-->
+
! style="width: 50%;"|You type
You type</translate>
+
! style="width: 50%;"|You get
! style="width: 50%;"|<translate><!--T:409-->
 
You get</translate>
 
 
|-
 
|-
 
| style="padding: 5px;"|
 
| style="padding: 5px;"|
 
<pre>
 
<pre>
 
{|
 
{|
<translate><!--T:54-->
+
|  Orange   ||   Apple   ||   more
Orange</translate> || <translate><!--T:380-->
 
Apple</translate> || <translate><!--T:381-->
 
more</translate>
 
 
|-
 
|-
<translate><!--T:55-->
+
|  Bread   ||   Pie     ||   more
Bread</translate> || <translate><!--T:382-->
 
Pie</translate> || <translate><!--T:383-->
 
more</translate>
 
 
|-
 
|-
<translate><!--T:56-->
+
|  Butter   || Ice cream || and more
Butter</translate> || <translate><!--T:384-->
 
Ice cream</translate> || <translate><!--T:385-->
 
and more</translate>
 
 
|}
 
|}
 
</pre>
 
</pre>
 
| style="padding: 5px;"|
 
| style="padding: 5px;"|
{|
+
{| align="center"
<translate><!--T:57-->
+
|  Orange   ||   Apple   ||   more
Orange</translate> || <translate><!--T:386-->
 
Apple</translate> || <translate><!--T:387-->
 
more</translate>
 
 
|-
 
|-
<translate><!--T:58-->
+
|  Bread   ||   Pie     ||   more
Bread</translate> || <translate><!--T:388-->
 
Pie</translate> || <translate><!--T:389-->
 
more</translate>
 
 
|-
 
|-
<translate><!--T:59-->
+
|  Butter   || Ice cream || and more
Butter</translate> || <translate><!--T:390-->
 
Ice cream</translate> || <translate><!--T:391-->
 
and more</translate>
 
 
|}
 
|}
 
|}
 
|}
  
<translate>
+
You can have longer text or more complex wiki syntax inside table cells, too:
<!--T:60-->
 
You can have longer text or more complex wiki syntax inside table cells, too:</translate>
 
  
{| style="width:100%"
+
{| width="100%"
! style="width: 50%;"|<translate><!--T:410-->
+
! style="width: 50%;"|You type
You type</translate>
+
! style="width: 50%;"|You get
! style="width: 50%;"|<translate><!--T:411-->
 
You get</translate>
 
 
|-
 
|-
 
| style="padding: 5px;"|
 
| style="padding: 5px;"|
257行目: 144行目:
 
</pre>
 
</pre>
 
| style="padding: 5px;"|
 
| style="padding: 5px;"|
{|
+
{| align="center"
 
|Lorem ipsum dolor sit amet,  
 
|Lorem ipsum dolor sit amet,  
 
consetetur sadipscing elitr,  
 
consetetur sadipscing elitr,  
275行目: 162行目:
 
|}
 
|}
  
<translate>
+
=== Table headers ===
=== Table headers === <!--T:61--></translate>
+
Table headers can be created by using "<code>!</code>" (exclamation mark) instead of "<code>|</code>" (pipe symbol). Headers usually show up bold and centered by default.
<translate>
 
<!--T:62-->
 
Table headers can be created by using "<code>!</code>" (exclamation mark) instead of "<code>|</code>" (pipe symbol).</translate>
 
<translate>
 
<!--T:63-->
 
Headers usually show up bold and centered by default.</translate>
 
  
{| style="width:100%"
+
{| width="100%"
! style="width: 50%;"|<translate><!--T:64-->
+
! style="width: 50%;"|You type
You type</translate>
+
! style="width: 50%;"|You get
! style="width: 50%;"|<translate><!--T:65-->
 
You get</translate>
 
 
|-
 
|-
 
| style="padding: 5px;"|
 
| style="padding: 5px;"|
 
<pre>
 
<pre>
 
{|
 
{|
! style="text-align:left;"| <translate><!--T:66-->
+
! align="left"| Item
Item</translate>
+
! Amount
! <translate><!--T:67-->
+
! Cost
Amount</translate>
 
! <translate><!--T:68-->
 
Cost</translate>
 
 
|-
 
|-
|<translate><!--T:69-->
+
|Orange
Orange</translate>
 
 
|10
 
|10
 
|7.00
 
|7.00
 
|-
 
|-
|<translate><!--T:70-->
+
|Bread
Bread</translate>
 
 
|4
 
|4
 
|3.00
 
|3.00
 
|-
 
|-
|<translate><!--T:71-->
+
|Butter
Butter</translate>
 
 
|1
 
|1
 
|5.00
 
|5.00
 
|-
 
|-
!<translate><!--T:72-->
+
!Total
Total</translate>
 
 
|
 
|
 
|15.00
 
|15.00
322行目: 194行目:
 
</pre>
 
</pre>
 
| style="padding: 5px;"|
 
| style="padding: 5px;"|
{|
+
{| align="center"
! style="text-align:left;"| <translate><!--T:73-->
+
! align="left"| Item
Item</translate>
+
! Amount
! <translate><!--T:74-->
+
! Cost
Amount</translate>
 
! <translate><!--T:75-->
 
Cost</translate>
 
 
|-
 
|-
|<translate><!--T:76-->
+
|Orange
Orange</translate>
 
 
|10
 
|10
 
|7.00
 
|7.00
 
|-
 
|-
|<translate><!--T:77-->
+
|Bread
Bread</translate>
 
 
|4
 
|4
 
|3.00
 
|3.00
 
|-
 
|-
|<translate><!--T:78-->
+
|Butter
Butter</translate>
 
 
|1
 
|1
 
|5.00
 
|5.00
 
|-
 
|-
!<translate><!--T:79-->
+
!Total
Total</translate>
 
 
|
 
|
 
|15.00
 
|15.00
352行目: 217行目:
 
|}
 
|}
  
<translate>
+
'''Note:''' When using attributes as in the heading 'Item' a vertical bar '|' is used for separation. Not an exclamation character '!'.
<!--T:80-->
 
'''Note:''' When using attributes as in the heading 'Item' a vertical bar '|' is used for separation.</translate>
 
<translate>
 
<!--T:81-->
 
Not an exclamation character '!'.</translate>
 
  
<translate>
+
===Caption===
===Caption=== <!--T:82--></translate>
+
A '''table caption''' can be added to the top of any table as follows.
<translate>
 
<!--T:83-->
 
A '''table caption''' can be added to the top of any table as follows.</translate>
 
  
{| style="width:100%"
+
{| width="100%"
! style="width: 50%;"|<translate><!--T:84-->
+
! style="width: 50%;"|You type
You type</translate>
+
! style="width: 50%;"|You get
! style="width: 50%;"|<translate><!--T:85-->
 
You get</translate>
 
 
|-
 
|-
 
| style="padding: 5px;"|
 
| style="padding: 5px;"|
 
<pre>
 
<pre>
 
{|
 
{|
|+<translate><!--T:86-->
+
|+Food complements
Food complements</translate>
 
 
|-
 
|-
|<translate><!--T:87-->
+
|Orange
Orange</translate>
+
|Apple
|<translate><!--T:88-->
 
Apple</translate>
 
 
|-
 
|-
|<translate><!--T:89-->
+
|Bread
Bread</translate>
+
|Pie
|<translate><!--T:90-->
 
Pie</translate>
 
 
|-
 
|-
|<translate><!--T:91-->
+
|Butter
Butter</translate>
+
|Ice cream  
|<translate><!--T:92-->
 
Ice cream</translate>
 
 
|}
 
|}
 
</pre>
 
</pre>
 
| style="padding: 5px;"|
 
| style="padding: 5px;"|
{|
+
{| align="center"
|+ <translate><!--T:93-->
+
|+ Food complements
Food complements</translate>
 
 
|-
 
|-
|<translate><!--T:94-->
+
|Orange
Orange</translate>
+
|Apple
|<translate><!--T:95-->
 
Apple</translate>
 
 
|-
 
|-
|<translate><!--T:96-->
+
|Bread
Bread</translate>
+
|Pie
|<translate><!--T:97-->
 
Pie</translate>
 
 
|-
 
|-
|<translate><!--T:98-->
+
|Butter
Butter</translate>
+
|Ice cream  
|<translate><!--T:99-->
 
Ice cream</translate>
 
 
|}
 
|}
 
|}
 
|}
  
<translate>
+
===class="wikitable"===
=== class="wikitable" === <!--T:100-->
+
Basic styling (light gray background, borders, padding and align left) can be achieved by adding class="wikitable".
 
 
<!--T:101-->
 
Basic styling (light gray background, borders, padding and align left) can be achieved by adding class="wikitable".</translate>
 
  
{| style="width:100%"
+
{| width="100%"
! style="width: 50%;"|<translate><!--T:102-->
+
! style="width: 50%;"|You type
You type</translate>
+
! style="width: 50%;"|You get
! style="width: 50%;"|<translate><!--T:103-->
 
You get</translate>
 
 
|-
 
|-
 
| style="padding: 5px;"|
 
| style="padding: 5px;"|
 
<pre>
 
<pre>
 
{| class="wikitable"
 
{| class="wikitable"
|+<translate><!--T:104-->
+
|+Food complements
Food complements</translate>
 
 
|-
 
|-
|<translate><!--T:105-->
+
|Orange
Orange</translate>
+
|Apple
|<translate><!--T:106-->
 
Apple</translate>
 
 
|-
 
|-
|<translate><!--T:107-->
+
|Bread
Bread</translate>
+
|Pie
|<translate><!--T:108-->
 
Pie</translate>
 
 
|-
 
|-
|<translate><!--T:109-->
+
|Butter
Butter</translate>
+
|Ice cream  
|<translate><!--T:110-->
 
Ice cream</translate>
 
 
|}
 
|}
 
</pre>
 
</pre>
 
| style="padding: 5px;"|
 
| style="padding: 5px;"|
{| class="wikitable"
+
{| align="center" class="wikitable"
|+ <translate><!--T:111-->
+
|+ Food complements
Food complements</translate>
 
 
|-
 
|-
|<translate><!--T:112-->
+
|Orange
Orange</translate>
+
|Apple
|<translate><!--T:113-->
 
Apple</translate>
 
 
|-
 
|-
|<translate><!--T:114-->
+
|Bread
Bread</translate>
+
|Pie
|<translate><!--T:115-->
 
Pie</translate>
 
 
|-
 
|-
|<translate><!--T:116-->
+
|Butter
Butter</translate>
+
|Ice cream  
|<translate><!--T:117-->
 
Ice cream</translate>
 
 
|}
 
|}
 
|}
 
|}
  
<translate>
+
== XHTML attributes ==
===HTML colspan and rowspan=== <!--T:118--></translate>
+
You can add XHTML attributes to tables. For the authoritative source on these, see [http://www.w3.org/TR/REC-html40/struct/tables.html the W3C's HTML 4.01 Specification page on tables].
  
<translate>
+
=== Attributes on tables ===
<!--T:119-->
+
Placing attributes after the table start tag (<code>{|</code>) applies attributes to the entire table.
You can use HTML '''colspan''' and '''rowspan''' attributes on cells for advanced layout.</translate>
 
  
{| style="width:100%"
+
{| width="100%"
! style="width: 50%;"|<translate><!--T:412-->
+
! style="width: 50%;"| You type
You type</translate>
+
! style="width: 50%;"| You get
! style="width: 50%;"|<translate><!--T:413-->
 
You get</translate>
 
|-
 
| style="padding: 5px;"|
 
<pre>
 
{| class="wikitable"
 
!colspan="6"|<translate><!--T:120-->
 
Shopping List</translate>
 
|-
 
|rowspan="2"|<translate><!--T:121-->
 
Bread & Butter</translate>
 
|<translate><!--T:122-->
 
Pie</translate>
 
|<translate><!--T:123-->
 
Buns</translate>
 
|<translate><!--T:124-->
 
Danish</translate>
 
|colspan="2"|<translate><!--T:125-->
 
Croissant</translate>
 
|-
 
|<translate><!--T:126-->
 
Cheese</translate>
 
|colspan="2"|<translate><!--T:127-->
 
Ice cream</translate>
 
|<translate><!--T:128-->
 
Butter</translate>
 
|<translate><!--T:129-->
 
Yogurt</translate>
 
|}
 
</pre>
 
| style="padding: 5px;"|
 
{| class="wikitable"
 
!colspan="6"|<translate><!--T:130-->
 
Shopping List</translate>
 
|-
 
|rowspan="2"|<translate><!--T:131-->
 
Bread & Butter</translate>
 
|<translate><!--T:132-->
 
Pie</translate>
 
|<translate><!--T:133-->
 
Buns</translate>
 
|<translate><!--T:134-->
 
Danish</translate>
 
|colspan="2"|<translate><!--T:135-->
 
Croissant</translate>
 
|-
 
|<translate><!--T:136-->
 
Cheese</translate>
 
|colspan="2"|<translate><!--T:137-->
 
Ice cream</translate>
 
|<translate><!--T:138-->
 
Butter</translate>
 
|<translate><!--T:139-->
 
Yogurt</translate>
 
|}
 
|}
 
 
 
<translate>
 
== XHTML attributes == <!--T:140--></translate>
 
<translate>
 
<!--T:141-->
 
You can add XHTML attributes to tables.</translate>
 
<translate>
 
<!--T:142-->
 
For the authoritative source on these, see [<tvar|url>https://www.w3.org/TR/html-markup/table.html</> the W3C's HTML Specification page on tables].</translate>
 
 
 
<translate>
 
=== Attributes on tables === <!--T:143--></translate>
 
<translate>
 
<!--T:144-->
 
Placing attributes after the table start tag (<code>{|</code>) applies attributes to the entire table.</translate>
 
 
 
{| style="width:100%"
 
! style="width: 50%;"| <translate><!--T:145-->
 
You type</translate>
 
! style="width: 50%;"| <translate><!--T:146-->
 
You get</translate>
 
 
|-
 
|-
 
| style="padding: 5px;"|
 
| style="padding: 5px;"|
 
<pre>
 
<pre>
 
{| class="wikitable" style="text-align: center; color: green;"
 
{| class="wikitable" style="text-align: center; color: green;"
|<translate><!--T:147-->
+
|Orange
Orange</translate>
+
|Apple
|<translate><!--T:148-->
 
Apple</translate>
 
 
|12,333.00
 
|12,333.00
 
|-
 
|-
|<translate><!--T:149-->
+
|Bread
Bread</translate>
+
|Pie
|<translate><!--T:150-->
 
Pie</translate>
 
 
|500.00
 
|500.00
 
|-
 
|-
|<translate><!--T:151-->
+
|Butter
Butter</translate>
+
|Ice cream
|<translate><!--T:152-->
 
Ice cream</translate>
 
 
|1.00
 
|1.00
 
|}
 
|}
 
</pre>
 
</pre>
 
| style="padding: 5px;"|
 
| style="padding: 5px;"|
{| class="wikitable" style="text-align: center; color: green;"
+
{| class="wikitable" align="center" style="text-align: center; color: green;"
|<translate><!--T:153-->
+
|Orange
Orange</translate>
+
|Apple
|<translate><!--T:154-->
 
Apple</translate>
 
 
|12,333.00
 
|12,333.00
 
|-
 
|-
|<translate><!--T:155-->
+
|Bread
Bread</translate>
+
|Pie
|<translate><!--T:156-->
 
Pie</translate>
 
 
|500.00
 
|500.00
 
|-
 
|-
|<translate><!--T:157-->
+
|Butter
Butter</translate>
+
|Ice cream
|<translate><!--T:158-->
 
Ice cream</translate>
 
 
|1.00
 
|1.00
 
|}
 
|}
 
|}
 
|}
  
<translate>
+
=== Attributes on cells ===
=== Attributes on cells === <!--T:159--></translate>
+
You can put attributes on individual '''cells'''. For example, numbers may look better aligned right.
<translate>
 
<!--T:160-->
 
You can put attributes on individual '''cells'''.</translate>
 
<translate>
 
<!--T:161-->
 
For example, numbers may look better aligned right.</translate>
 
  
{| style="width:100%"
+
{| width="100%"
! style="width: 50%;"| <translate><!--T:162-->
+
! style="width: 50%;"| You type
You type</translate>
+
! style="width: 50%;"| You get
! style="width: 50%;"| <translate><!--T:163-->
 
You get</translate>
 
 
|-
 
|-
 
| style="padding: 5px;"|
 
| style="padding: 5px;"|
 
<pre>
 
<pre>
 
{| class="wikitable"
 
{| class="wikitable"
| <translate><!--T:164-->
+
| Orange
Orange</translate>
+
| Apple
| <translate><!--T:165-->
+
| align="right"| 12,333.00
Apple</translate>
 
| style="text-align:right;" | 12,333.00
 
 
|-
 
|-
| <translate><!--T:166-->
+
| Bread
Bread</translate>
+
| Pie
| <translate><!--T:167-->
+
| align="right"| 500.00
Pie</translate>
 
| style="text-align:right;" | 500.00
 
 
|-
 
|-
| <translate><!--T:168-->
+
| Butter
Butter</translate>
+
| Ice cream
| <translate><!--T:169-->
+
| align="right"| 1.00
Ice cream</translate>
 
| style="text-align:right;" | 1.00
 
 
|}
 
|}
 
</pre>
 
</pre>
 
| style="padding: 5px;"|
 
| style="padding: 5px;"|
{| class="wikitable" style="text-align:center"
+
{| class="wikitable" align="center"
| <translate><!--T:170-->
+
| Orange
Orange</translate>
+
| Apple
| <translate><!--T:171-->
+
| align="right"| 12,333.00
Apple</translate>
 
| style="text-align:right;" | 12,333.00
 
 
|-
 
|-
| <translate><!--T:172-->
+
| Bread
Bread</translate>
+
| Pie
| <translate><!--T:173-->
+
| align="right"| 500.00
Pie</translate>
 
| style="text-align:right;" | 500.00
 
 
|-
 
|-
| <translate><!--T:174-->
+
| Butter
Butter</translate>
+
| Ice cream
| <translate><!--T:175-->
+
| align="right"| 1.00
Ice cream</translate>
 
| style="text-align:right;" | 1.00
 
 
|}
 
|}
 
|}
 
|}
  
<translate>
+
You can also use '''cell''' attributes when you are listing multiple '''cells''' on a single line. Note that the '''cells''' are separated by <code>||</code>, and within each '''cell''' the attribute(s) and value are separated by <code>|</code>.
<!--T:176-->
 
You can also use '''cell''' attributes when you are listing multiple '''cells''' on a single line.</translate>
 
<translate>
 
<!--T:177-->
 
Note that the '''cells''' are separated by <code>||</code>, and within each '''cell''' the attribute(s) and value are separated by <code>|</code>.</translate>
 
  
{| style="width:100%"
+
{| width="100%"
! style="width: 50%;"| <translate><!--T:178-->
+
! style="width: 50%;"| You type
You type</translate>
+
! style="width: 50%;"| You get
! style="width: 50%;"| <translate><!--T:179-->
 
You get</translate>
 
 
|-
 
|-
 
| style="padding: 5px;"|
 
| style="padding: 5px;"|
 
<pre>
 
<pre>
 
{| class="wikitable"
 
{| class="wikitable"
| <translate><!--T:180-->
+
| Orange || Apple    || align="right" | 12,333.00
Orange</translate> || <translate><!--T:373-->
 
Apple</translate>     || style="text-align:right;" | 12,333.00
 
 
|-
 
|-
| <translate><!--T:181-->
+
| Bread || Pie      || align="right" | 500.00
Bread</translate> || <translate><!--T:374-->
 
Pie</translate>       || style="text-align:right;" | 500.00
 
 
|-
 
|-
| <translate><!--T:182-->
+
| Butter || Ice cream || align="right" | 1.00
Butter</translate> || <translate><!--T:375-->
 
Ice cream</translate> || style="text-align:right;" | 1.00
 
 
|}
 
|}
 
</pre>
 
</pre>
 
| style="padding: 5px;"|
 
| style="padding: 5px;"|
{| class="wikitable"
+
{| class="wikitable" align="center"
| <translate><!--T:183-->
+
| Orange || Apple    || align="right" | 12,333.00
Orange</translate> || <translate><!--T:376-->
 
Apple</translate>     || style="text-align:right;" | 12,333.00
 
 
|-
 
|-
| <translate><!--T:184-->
+
| Bread || Pie      || align="right" | 500.00
Bread</translate> || <translate><!--T:377-->
 
Pie</translate>       || style="text-align:right;" | 500.00
 
 
|-
 
|-
| <translate><!--T:185-->
+
| Butter || Ice cream || align="right" | 1.00
Butter</translate> || <translate><!--T:378-->
 
Ice cream</translate> || style="text-align:right;" | 1.00
 
 
|}
 
|}
 
|}
 
|}
  
<translate>
+
===Attributes on rows===
===Attributes on rows=== <!--T:186--></translate>
+
You can put attributes on individual '''rows''', too.
<translate>
 
<!--T:187-->
 
You can put attributes on individual '''rows''', too.</translate>
 
  
{| style="width:100%"
+
{| width="100%"
! style="width: 50%;"|<translate><!--T:188-->
+
! style="width: 50%;"|You type
You type</translate>
+
! style="width: 50%;"|You get
! style="width: 50%;"|<translate><!--T:189-->
 
You get</translate>
 
 
|-
 
|-
 
| style="padding: 5px;"|
 
| style="padding: 5px;"|
 
<pre>
 
<pre>
 
{| class="wikitable"
 
{| class="wikitable"
| <translate><!--T:190-->
+
| Orange
Orange</translate>
+
| Apple
| <translate><!--T:191-->
+
| align="right"| 12,333.00
Apple</translate>
 
| style="text-align:right;"| 12,333.00
 
 
|-
 
|-
| <translate><!--T:192-->
+
| Bread
Bread</translate>
+
| Pie
| <translate><!--T:193-->
+
| align="right"| 500.00
Pie</translate>
 
| style="text-align:right;"| 500.00
 
 
|- style="font-style: italic; color: green;"
 
|- style="font-style: italic; color: green;"
| <translate><!--T:194-->
+
| Butter
Butter</translate>
+
| Ice cream
| <translate><!--T:195-->
+
| align="right"| 1.00
Ice cream</translate>
 
| style="text-align:right;"| 1.00
 
 
|}
 
|}
 
</pre>
 
</pre>
 
| style="padding: 5px;"|
 
| style="padding: 5px;"|
{| class="wikitable"
+
{| class="wikitable" align="center"
| <translate><!--T:196-->
+
| Orange
Orange</translate>
+
| Apple
| <translate><!--T:197-->
+
| align="right"| 12,333.00
Apple</translate>
 
| style="text-align:right;"| 12,333.00
 
 
|-
 
|-
| <translate><!--T:198-->
+
| Bread
Bread</translate>
+
| Pie
| <translate><!--T:199-->
+
| align="right"| 500.00
Pie</translate>
 
| style="text-align:right;"| 500.00
 
 
|- style="font-style: italic; color: green;"
 
|- style="font-style: italic; color: green;"
| <translate><!--T:200-->
+
| Butter
Butter</translate>
+
| Ice cream
| <translate><!--T:201-->
+
| align="right"| 1.00
Ice cream</translate>
 
| style="text-align:right;"| 1.00
 
 
|}
 
|}
 
|}
 
|}
  
<translate>
+
====Simple one-pixel table border====
===Simple one-pixel table border=== <!--T:202--></translate>
+
The default table formatting uses the "border-collapse: separate" model, which adds table cell spacing (which also separates the table outer border from its content cells). Even with a zero cellspacing, the borders of consecutive cells (and of the overall table container) will add up, so to get a one-pixel separation between cells, you need to selectively remove one or more of the four borders of cells.
<translate>
+
 
<!--T:203-->
+
Such tables may be formatted more simply, using the "border-collapse: collapse" CSS property; in this table formatting model, the cellspacing attribute (or the CSS "border-spacing:" property) and the table's "padding:" CSS property is ignored and only the larger border of adjacent inner cells (or the table border for outer cells) will be used.
An example of a one-pixel table border:</translate>
+
 
 +
An example of the above for one-pixel table border, using each model (without need for external extensions):
  
{| style="width:100%"
+
{| width=100%
 +
|-
 +
! You type
 +
! You get
 
|-
 
|-
! style="width:50%" | <translate><!--T:204-->
+
| width=50% style="padding: 5px;" |
You type</translate>
+
<pre style="font-size: 80%">
! style="width:50%" | <translate><!--T:205-->
+
{| style="border-collapse: separate;
You get</translate>
+
          border-spacing: 0;
 +
          border: 1px solid #000;
 +
          padding: 0"
 
|-
 
|-
| style="padding: 5px;" |
+
| style="border-style: solid; border-width: 0 1px 1px 0"|  
<pre>
+
Orange
{| border="1" style="border-collapse:collapse"
+
| style="border-style: solid; border-width: 0 0 1px 0"|  
| <translate><!--T:206-->
+
Apple
Orange</translate>
 
| <translate><!--T:207-->
 
Apple</translate>
 
 
|-
 
|-
| <translate><!--T:208-->
+
| style="border-style: solid; border-width: 0 1px 0 0"|
Bread</translate>
+
Bread
| <translate><!--T:209-->
+
| style="border-style: solid; border-width: 0"|
Pie</translate>
+
Pie
 
|}
 
|}
 
</pre>
 
</pre>
| style="padding: 20px;"|
+
| width=50% style="padding: 20px;"|
{| border="1" style="border-collapse:collapse"
+
{| style="border-collapse: separate; border-spacing: 0; border: 1px solid #000; padding: 0"
| <translate><!--T:210-->
+
|-
Orange</translate>
+
| style="border-style: solid; border-width: 0 1px 1px 0"| Orange
| <translate><!--T:211-->
+
| style="border-style: solid; border-width: 0 0 1px 0"| Apple
Apple</translate>
 
 
|-
 
|-
| <translate><!--T:212-->
+
| style="border-style: solid; border-width: 0 1px 0 0"| Bread
Bread</translate>
+
| style="border-style: solid; border-width: 0"| Pie
| <translate><!--T:213-->
 
Pie</translate>
 
 
|}
 
|}
|}
 
 
<translate>
 
===Border width=== <!--T:214--></translate>
 
<translate>
 
<!--T:215-->
 
If "border-width:" has only one number, it is for all four border sides:</translate>
 
{| style="width:100%"
 
 
|-
 
|-
! style="width:50%" | <translate><!--T:216-->
+
| style="padding: 5px;"|
You type</translate>
+
<pre style="font-size: 80%">
! style="width:50%" | <translate><!--T:217-->
+
{| style="border-collapse: collapse; border: 1px solid #000"
You get</translate>
+
|-
 +
| style="border-style: solid; border-width: 1px"|  
 +
Orange
 +
| style="border-style: solid; border-width: 1px"|
 +
Apple
 
|-
 
|-
| style="padding: 5px;" |
+
| style="border-style: solid; border-width: 1px"|  
<pre>
+
Bread
{|style="border-style: solid; border-width: 20px"
+
| style="border-style: solid; border-width: 1px"|  
|
+
Pie
<translate><!--T:218-->
 
Hello</translate>
 
 
|}
 
|}
 
</pre>
 
</pre>
 
| style="padding: 20px;"|
 
| style="padding: 20px;"|
{|style="border-style: solid; border-width: 20px"
+
{| style="border-collapse: collapse; border: 1px solid #000"
|
+
|-
<translate><!--T:219-->
+
| style="border-style: solid; border-width: 1px"| Orange
Hello</translate>
+
| style="border-style: solid; border-width: 1px"| Apple
 +
|-
 +
| style="border-style: solid; border-width: 1px"| Bread
 +
| style="border-style: solid; border-width: 1px"| Pie
 
|}
 
|}
 
|}
 
|}
  
<translate>
+
Notes :
<!--T:220-->
+
* When using the "border-width:" CSS shortcut property, the order of the four space-separated specified values is: top, right, bottom, left. As an example from above:  
If "border-width:" has more than one number, the four numbers are for '''top, right, bottom, left (REMEMBER this order)''':</translate>
+
::"border-width: 0 1px 0 0"  
 +
:When there are fewer than 4 values, the value for left takes its default from the value for right, the value for bottom takes its default from the value for top, and the value for right takes its default from the value for top.
 +
* The HTML attributes (such as "width=", "border=", "cellspacing=", "cellpadding=") do not need any length unit (the pixel unit is assumed). The CSS style properties (which override the HTML attributes) require an explicit length unit (if the value is not 0) such as "px" for the pixel.
 +
 
 +
===HTML colspan and rowspan===
 +
 
 +
You can use HTML '''colspan''' and '''rowspan''' attributes on cells for advanced layout.
  
{| style="width:100%"
+
{| width="100%"
 +
! style="width: 50%;"|You type
 +
! style="width: 50%;"|You get
 +
|-
 +
| style="padding: 5px;"|
 +
<pre>
 +
{| class="wikitable"
 +
!colspan="6"|Shopping List
 
|-
 
|-
! style="width:50%" | <translate><!--T:221-->
+
|rowspan="2"|Bread & Butter
You type</translate>
+
|Pie
! style="width:50%" | <translate><!--T:222-->
+
|Buns
You get</translate>
+
|Danish
 +
|colspan="2"|Croissant
 
|-
 
|-
| style="padding: 5px;" |
+
|Cheese
<pre>
+
|colspan="2"|Ice cream
{|style="border-style: solid; border-width: 10px 20px 100px 0"
+
|Butter
|
+
|Yogurt
<translate><!--T:223-->
 
Hello</translate>
 
 
|}
 
|}
 
</pre>
 
</pre>
| style="padding: 20px;"|
+
| style="padding: 5px;"|
{|style="border-style: solid; border-width: 10px 20px 100px 0"
+
{| class="wikitable" align="center"
|
+
!colspan="6"|Shopping List
<translate><!--T:224-->
 
Hello</translate>
 
|}
 
|}
 
 
 
<translate>
 
<!--T:225-->
 
:When there are fewer than 4 values, the value for left takes its default from the value for right, the value for bottom takes its default from the value for top, and the value for right takes its default from the value for top.</translate>
 
 
 
<translate>
 
<!--T:226-->
 
Another method to define the widths of the four sides of a cell is to use ''"border-left", "border-right", "border-top" and "border-bottom"'':</translate>
 
<div style="width: 100%; overflow:auto;">
 
{| style="width:100%"
 
 
|-
 
|-
! style="width:50%" | <translate><!--T:227-->
+
|rowspan="2"|Bread & Butter
You type</translate>
+
|Pie
! style="width:50%" | <translate><!--T:228-->
+
|Buns
You get</translate>
+
|Danish
 +
|colspan="2"|Croissant
 
|-
 
|-
| style="padding: 5px;" |
+
|Cheese
<pre>
+
|colspan="2"|Ice cream
{|style="border-left:solid 10px black;border-right:solid 20px black;border-top:solid 30px black;border-bottom:solid 40px black;" align="center"
+
|Butter
|
+
|Yogurt
<translate><!--T:229-->
 
Hello</translate>
 
|}
 
</pre>
 
| style="padding: 20px;"|
 
{|style="border-left:solid 10px black;border-right:solid 20px black;border-top:solid 30px black;border-bottom:solid 40px black;" align="center"
 
|
 
<translate><!--T:230-->
 
Hello</translate>
 
 
|}
 
|}
 
|}
 
|}
</div>
 
  
{{TNT|Note}}
+
===With HTML attributes and CSS styles===
<translate><!--T:231-->
+
[[Manual:CSS|CSS]] style attributes can be added with or without other HTML attributes.
* The HTML attributes (such as "width=", "border=", "cellspacing=", "cellpadding=") do not need any length unit (the pixel unit is assumed).</translate> <translate><!--T:414-->
 
They are also invalid in HTML 5.</translate>
 
<translate>
 
<!--T:232-->
 
The CSS style properties (which override the HTML attributes) require an explicit length unit (if the value is not 0) such as "px" for the pixel.</translate>
 
  
<translate>
+
{| width="100%"
===With HTML attributes and CSS styles=== <!--T:233--></translate>
+
! style="width: 50%;"|You type
<translate>
+
! style="width: 50%;"|You get
<!--T:234-->
 
[[Special:MyLanuage/Manual:CSS|CSS]] style attributes can be added with or without other HTML attributes.</translate>
 
 
 
{| style="width:100%"
 
! style="width: 50%;"|<translate><!--T:235-->
 
You type</translate>
 
! style="width: 50%;"|<translate><!--T:236-->
 
You get</translate>
 
 
|-
 
|-
 
| style="padding: 5px;"|
 
| style="padding: 5px;"|
 
<pre>
 
<pre>
 
{| class="wikitable" style="color:green; background-color:#ffffcc;" cellpadding="10"
 
{| class="wikitable" style="color:green; background-color:#ffffcc;" cellpadding="10"
|<translate><!--T:237-->
+
|Orange
Orange</translate>
+
|Apple
|<translate><!--T:238-->
 
Apple</translate>
 
 
|-
 
|-
|<translate><!--T:239-->
+
|Bread
Bread</translate>
+
|Pie
|<translate><!--T:240-->
 
Pie</translate>
 
 
|-
 
|-
|<translate><!--T:241-->
+
|Butter
Butter</translate>
+
|Ice cream  
|<translate><!--T:242-->
 
Ice cream</translate>
 
 
|}
 
|}
 
</pre>
 
</pre>
 
| style="padding: 5px;"|
 
| style="padding: 5px;"|
 
{| class="wikitable" style="color:green; background-color:#ffffcc;" cellpadding="10"  
 
{| class="wikitable" style="color:green; background-color:#ffffcc;" cellpadding="10"  
|<translate><!--T:243-->
+
|Orange
Orange</translate>
+
|Apple
|<translate><!--T:244-->
 
Apple</translate>
 
 
|-
 
|-
|<translate><!--T:245-->
+
|Bread
Bread</translate>
+
|Pie
|<translate><!--T:246-->
 
Pie</translate>
 
 
|-
 
|-
|<translate><!--T:247-->
+
|Butter
Butter</translate>
+
|Ice cream  
|<translate><!--T:248-->
 
Ice cream</translate>
 
 
|}
 
|}
 
|}
 
|}
  
<translate>
+
====Attributes====
====Attributes==== <!--T:249--></translate>
+
'''Attributes''' can be added to the caption and headers as follows.
<translate>
 
<!--T:250-->
 
'''Attributes''' can be added to the caption and headers as follows.</translate>
 
  
{| style="width:100%"
+
{| width="100%"
! style="width: 50%;"|<translate><!--T:251-->
+
! style="width: 50%;"|You type
You type</translate>
+
! style="width: 50%;"|You get
! style="width: 50%;"|<translate><!--T:252-->
 
You get</translate>
 
 
|-
 
|-
 
| style="padding: 5px;"|
 
| style="padding: 5px;"|
 
<pre>
 
<pre>
 
{| class="wikitable"
 
{| class="wikitable"
|+ style="caption-side:bottom; color:#e76700;"|<translate><!--T:253-->
+
|+ align="bottom" style="color:#e76700;"|''Food complements''
''Food complements''</translate>
 
 
|-
 
|-
|<translate><!--T:254-->
+
|Orange
Orange</translate>
+
|Apple
|<translate><!--T:255-->
 
Apple</translate>
 
 
|-
 
|-
|<translate><!--T:256-->
+
|Bread
Bread</translate>
+
|Pie
|<translate><!--T:257-->
 
Pie</translate>
 
 
|-
 
|-
|<translate><!--T:258-->
+
|Butter
Butter</translate>
+
|Ice cream  
|<translate><!--T:259-->
 
Ice cream</translate>
 
 
|}
 
|}
 
</pre>
 
</pre>
 
| style="padding: 5px;"|
 
| style="padding: 5px;"|
 
{| class="wikitable"
 
{| class="wikitable"
|+ style="caption-side:bottom; color:#e76700;"|<translate><!--T:260-->
+
|+ align="bottom" style="color:#e76700;" |''Food complements''
''Food complements''</translate>
 
 
|-
 
|-
|<translate><!--T:261-->
+
|Orange
Orange</translate>
+
|Apple
|<translate><!--T:262-->
 
Apple</translate>
 
 
|-
 
|-
|<translate><!--T:263-->
+
|Bread
Bread</translate>
+
|Pie
|<translate><!--T:264-->
 
Pie</translate>
 
 
|-
 
|-
|<translate><!--T:265-->
+
|Butter
Butter</translate>
+
|Ice cream  
|<translate><!--T:266-->
 
Ice cream</translate>
 
 
|}
 
|}
 
|}
 
|}
  
<translate>
+
====Column width====
====Column width==== <!--T:267--></translate>
+
'''Column width''' can be added as follows.
<translate>
 
<!--T:268-->
 
'''Column width''' can be added as follows.</translate>
 
  
<translate>
+
You type:
<!--T:269-->
 
You type:</translate>
 
 
<pre>
 
<pre>
{| style="color: black; background-color: #ffffcc; width: 85%;"
+
{| style="color: black; background-color: #ffffcc;" width="85%"
| colspan="2" | <translate><!--T:270-->
+
| colspan="2" | This column width is 85% of the screen width (and has a background color)
This column width is 85% of the screen width (and has a background color)</translate>
 
 
|-
 
|-
 
| style="width: 30%; background-color: white;"|
 
| style="width: 30%; background-color: white;"|
<translate><!--T:271-->
+
'''This column is 30% counted from 85% of the screen width'''
'''This column is 30% counted from 85% of the screen width'''</translate>
 
 
| style="width: 70%; background-color: orange;"|
 
| style="width: 70%; background-color: orange;"|
<translate><!--T:272-->
+
'''This column is 70% counted from 85% of the screen width (and has a background color)'''
'''This column is 70% counted from 85% of the screen width (and has a background color)'''</translate>
 
 
|}
 
|}
 
</pre>
 
</pre>
  
<translate>
+
You get:
<!--T:273-->
+
{| style="color: black; background-color: #ffffcc;" width="85%"  
You get:</translate>
+
| colspan="2" | This column width is 85% of the screen width (and has a background color)
{| style="color: black; background-color: #ffffcc; width: 85%;"
 
| colspan="2" | <translate><!--T:274-->
 
This column width is 85% of the screen width (and has a background color)</translate>
 
 
|-
 
|-
| style="width: 30%; background-color: white;"| <translate><!--T:275-->
+
| style="width: 30%; background-color: white;"| '''This column is 30% counted from 85% of the screen width'''
'''This column is 30% counted from 85% of the screen width'''</translate>
+
| style="width: 70%; background-color: orange;"| '''This column is 70% counted from 85% of the screen width (and has a background color)'''
| style="width: 70%; background-color: orange;"| <translate><!--T:276-->
 
'''This column is 70% counted from 85% of the screen width (and has a background color)'''</translate>
 
 
|}
 
|}
  
<translate>
+
===Accessibility of table header cells===
===Accessibility of table header cells=== <!--T:277--></translate>
+
Table header cells do not explicitly specify which table data cells they apply to (those on their right on the same row, or those below them on the same column). When the table is rendered in a visual 2D environment, this is usually easy to infer.
<translate>
 
<!--T:278-->
 
Table header cells do not explicitly specify which table data cells they apply to (those on their right on the same row, or those below them on the same column).</translate>
 
<translate>
 
<!--T:279-->
 
When the table is rendered in a visual 2D environment, this is usually easy to infer.</translate>
 
  
<translate>
+
However when tables are rendered on non-visual media, you can help the browser to determine which table header cell applies to the description of any selected cell (in order to repeat its content in some accessibility helper) using a scope="row" or scope="col" attribute on table header cells. In most cases with simple tables, you'll use scope="col" on all header cells of the first row, and scope="row" on the first cell of the following rows:
<!--T:280-->
 
However when tables are rendered on non-visual media, you can help the browser to determine which table header cell applies to the description of any selected cell (in order to repeat its content in some accessibility helper) using a scope="row" or scope="col" attribute on table header cells.</translate>
 
<translate>
 
<!--T:281-->
 
In most cases with simple tables, you'll use scope="col" on all header cells of the first row, and scope="row" on the first cell of the following rows:</translate>
 
  
{| style="width:100%"
+
{| width="100%"
! style="width: 50%;"|<translate><!--T:282-->
+
! style="width: 50%;"|You type
You type</translate>
+
! style="width: 50%;"|You get
! style="width: 50%;"|<translate><!--T:283-->
 
You get</translate>
 
 
|-
 
|-
 
| style="padding: 5px;"|
 
| style="padding: 5px;"|
1,067行目: 659行目:
 
{| class="wikitable"
 
{| class="wikitable"
 
|-
 
|-
! scope="col"| <translate><!--T:284-->
+
! scope="col"| Item
Item</translate>
+
! scope="col"| Quantity
! scope="col"| <translate><!--T:285-->
+
! scope="col"| Price
Quantity</translate>
 
! scope="col"| <translate><!--T:286-->
 
Price</translate>
 
 
|-
 
|-
! scope="row"| <translate><!--T:287-->
+
! scope="row"| Bread
Bread</translate>
 
 
| 0.3 kg
 
| 0.3 kg
 
| $0.65
 
| $0.65
 
|-
 
|-
! scope="row"| <translate><!--T:288-->
+
! scope="row"| Butter
Butter</translate>
 
 
| 0.125 kg
 
| 0.125 kg
 
| $1.25
 
| $1.25
 
|-
 
|-
! scope="row" colspan="2"| <translate><!--T:289-->
+
! scope="row" colspan="2"| Total
Total</translate>
 
 
| $1.90
 
| $1.90
 
|}
 
|}
 
</pre>
 
</pre>
 
| style="padding: 5px;"|
 
| style="padding: 5px;"|
{| class="wikitable"
+
{| class="wikitable" align="center"
 
|-
 
|-
! scope="col"| <translate><!--T:290-->
+
! scope="col"| Item
Item</translate>
+
! scope="col"| Quantity
! scope="col"| <translate><!--T:291-->
+
! scope="col"| Price
Quantity</translate>
 
! scope="col"| <translate><!--T:292-->
 
Price</translate>
 
 
|-
 
|-
! scope="row"| <translate><!--T:293-->
+
! scope="row"| Bread
Bread</translate>
 
 
| 0.3 kg
 
| 0.3 kg
 
| $0.65
 
| $0.65
 
|-
 
|-
! scope="row"| <translate><!--T:294-->
+
! scope="row"| Butter
Butter</translate>
 
 
| 0.125 kg
 
| 0.125 kg
 
| $1.25
 
| $1.25
 
|-
 
|-
! scope="row" colspan="2"| <translate><!--T:295-->
+
! scope="row" colspan="2"| Total
Total</translate>
 
 
| $1.90
 
| $1.90
 
|}
 
|}
 
|}
 
|}
  
<translate>
+
==Caveats==
== Alignment == <!--T:296--></translate>
 
 
 
<translate>
 
=== Table alignment === <!--T:297--></translate>
 
 
 
<translate>
 
<!--T:298-->
 
Table alignment is achieved by using CSS.</translate>
 
<translate>
 
<!--T:299-->
 
The table alignment is controlled by margins.</translate>
 
<translate>
 
<!--T:300-->
 
A fixed margin on one side will make the table to be aligned to that side, if on the opposite side the margin is defined as ''auto''.</translate>
 
<translate>
 
<!--T:301-->
 
To have a table center aligned, you should set both margins to ''auto''</translate>
 
 
 
<translate>
 
<!--T:302-->
 
For example, a right-aligned table:</translate>
 
 
 
{| style="width:100%"
 
! style="width: 50%;"|<translate><!--T:303-->
 
You type</translate>
 
! style="width: 50%;"|<translate><!--T:304-->
 
You get</translate>
 
|-
 
| style="padding: 5px;"|
 
<pre>
 
{| class="wikitable" style="margin-left: auto; margin-right: 0px;"
 
| <translate><!--T:305-->
 
Orange</translate>
 
| <translate><!--T:306-->
 
Apple</translate>
 
|-
 
| <translate><!--T:307-->
 
Bread</translate>
 
| <translate><!--T:308-->
 
Pie</translate>
 
|-
 
| <translate><!--T:309-->
 
Butter</translate>
 
| <translate><!--T:310-->
 
Ice cream</translate>
 
|}
 
</pre>
 
| style="padding: 5px;"|
 
{| class="wikitable" style="margin-left: auto; margin-right: 0px;"
 
| <translate><!--T:311-->
 
Orange</translate>
 
| <translate><!--T:312-->
 
Apple</translate>
 
|-
 
| <translate><!--T:313-->
 
Bread</translate>
 
| <translate><!--T:314-->
 
Pie</translate>
 
|-
 
| <translate><!--T:315-->
 
Butter</translate>
 
| <translate><!--T:316-->
 
Ice cream</translate>
 
|}
 
|}
 
 
 
<translate>
 
<!--T:317-->
 
And a center-aligned table:</translate>
 
 
 
{| style="width:100%"
 
! style="width: 50%;"|<translate><!--T:318-->
 
You type</translate>
 
! style="width: 50%;"|<translate><!--T:319-->
 
You get</translate>
 
|-
 
| style="padding: 5px;"|
 
<pre>
 
{| class="wikitable" style="margin: auto;"
 
| <translate><!--T:320-->
 
Orange</translate>
 
| <translate><!--T:321-->
 
Apple</translate>
 
|-
 
| <translate><!--T:322-->
 
Bread</translate>
 
| <translate><!--T:323-->
 
Pie</translate>
 
|-
 
| <translate><!--T:324-->
 
Butter</translate>
 
| <translate><!--T:325-->
 
Ice cream</translate>
 
|}
 
</pre>
 
| style="padding: 5px;"|
 
{| class="wikitable" style="margin: auto;"
 
| <translate><!--T:326-->
 
Orange</translate>
 
| <translate><!--T:327-->
 
Apple</translate>
 
|-
 
| <translate><!--T:328-->
 
Bread</translate>
 
| <translate><!--T:329-->
 
Pie</translate>
 
|-
 
| <translate><!--T:330-->
 
Butter</translate>
 
| <translate><!--T:331-->
 
Ice cream</translate>
 
|}
 
|}
 
 
 
<translate>
 
=== Table floating around text === <!--T:332--></translate>
 
 
 
<translate>
 
<!--T:333-->
 
If you align a table to the right or the left side of the page, the text that comes after the table starts at the end of it, leaving an empty space around the table.</translate>
 
<translate>
 
<!--T:334-->
 
You can make the text to be wrapped around the table by making the table to ''float'' around the text instead of just aligning it.</translate>
 
<translate>
 
<!--T:335-->
 
This can be achieved using the <code>float</code> CSS attribute, which can specify where the table floats to the right side or to the left.</translate>
 
<translate>
 
<!--T:336-->
 
When using ''float'', margins doesn't control table alignment and can be used to specify the margin between the table and the surrounding text.</translate>
 
 
 
{| style="width:100%"
 
! style="width: 50%;"|<translate><!--T:337-->
 
You type</translate>
 
! style="width: 50%;"|<translate><!--T:338-->
 
You get</translate>
 
|-
 
| style="padding: 5px;"|
 
<pre>
 
{| class="wikitable" style="float:right; margin-left: 10px;"
 
| <translate><!--T:339-->
 
Orange</translate>
 
| <translate><!--T:340-->
 
Apple</translate>
 
|-
 
| <translate><!--T:341-->
 
Bread</translate>
 
| <translate><!--T:342-->
 
Pie</translate>
 
|-
 
| <translate><!--T:343-->
 
Butter</translate>
 
| <translate><!--T:344-->
 
Ice cream</translate>
 
|}
 
 
 
Lorem ipsum dolor sit amet, consectetuer adipiscing
 
elit, sed diam nonummy nibh euismod tincidunt ut
 
laoreet dolore magna aliquam erat volutpat. Ut wisi
 
enim ad minim veniam, quis nostrud exerci tation
 
ullamcorper suscipit lobortis nisl ut aliquip ex ea
 
commodo consequat. Duis autem vel eum iriure dolor
 
in hendrerit in vulputate velit esse molestie consequat,
 
vel illum dolore eu feugiat nulla facilisis at vero
 
eros et accumsan et iusto odio dignissim qui blandit
 
praesent luptatum zzril delenit augue duis dolore te
 
feugait nulla facilisi.
 
</pre>
 
| style="padding: 5px;"|
 
{| class="wikitable" style="float:right; margin-left: 10px;"
 
| <translate><!--T:345-->
 
Orange</translate>
 
| <translate><!--T:346-->
 
Apple</translate>
 
|-
 
| <translate><!--T:347-->
 
Bread</translate>
 
| <translate><!--T:348-->
 
Pie</translate>
 
|-
 
| <translate><!--T:349-->
 
Butter</translate>
 
| <translate><!--T:350-->
 
Ice cream</translate>
 
|}
 
 
 
Lorem ipsum dolor sit amet, consectetuer adipiscing
 
elit, sed diam nonummy nibh euismod tincidunt ut
 
laoreet dolore magna aliquam erat volutpat. Ut wisi
 
enim ad minim veniam, quis nostrud exerci tation
 
ullamcorper suscipit lobortis nisl ut aliquip ex ea
 
commodo consequat. Duis autem vel eum iriure dolor
 
in hendrerit in vulputate velit esse molestie consequat,
 
vel illum dolore eu feugiat nulla facilisis at vero
 
eros et accumsan et iusto odio dignissim qui blandit
 
praesent luptatum zzril delenit augue duis dolore te
 
feugait nulla facilisi.
 
|}
 
 
 
<translate>
 
=== Cell contents alignment === <!--T:351--></translate>
 
 
 
<translate>
 
<!--T:352-->
 
The alignment of cell contents can be controlled with 2 different CSS properties: <code>text-align</code> and <code>vertical-align</code>.</translate>
 
<translate>
 
<!--T:353-->
 
<code>text-align</code> can be specified at the table, row or individual cells, while <code>vertical-align</code> only can be specified at individual rows or cells.</translate>
 
 
 
{| style="width:100%"
 
! style="width: 50%;"|<translate><!--T:354-->
 
You type</translate>
 
! style="width: 50%;"|<translate><!--T:355-->
 
You get</translate>
 
|-
 
| style="padding: 5px;"|
 
<pre>
 
{| class="wikitable"
 
|- style="vertical-align:top;"
 
| style="height:100px; width:100px; text-align:left;" | A
 
| style="height:100px; width:100px; text-align:center;" | B
 
| style="height:100px; width:100px; text-align:right;" | C
 
|- style="vertical-align:middle;"
 
| style="height:100px; width:100px; text-align:left;" | D
 
| style="height:100px; width:100px; text-align:center;" | E
 
| style="height:100px; width:100px; text-align:right;" | F
 
|- style="vertical-align:bottom;"
 
| style="height:100px; width:100px; text-align:left;" | G
 
| style="height:100px; width:100px; text-align:center;" | H
 
| style="height:100px; width:100px; text-align:right;" | I
 
|}
 
</pre>
 
| style="padding: 5px;"|
 
{| class="wikitable"
 
|- style="vertical-align:top;"
 
| style="height:100px; width:100px; text-align:left;" | A
 
| style="height:100px; width:100px; text-align:center;" | B
 
| style="height:100px; width:100px; text-align:right;" | C
 
|- style="vertical-align:middle;"
 
| style="height:100px; width:100px; text-align:left;" | D
 
| style="height:100px; width:100px; text-align:center;" | E
 
| style="height:100px; width:100px; text-align:right;" | F
 
|- style="vertical-align:bottom;"
 
| style="height:100px; width:100px; text-align:left;" | G
 
| style="height:100px; width:100px; text-align:center;" | H
 
| style="height:100px; width:100px; text-align:right;" | I
 
|}
 
|}
 
 
 
<translate>
 
==Caveats== <!--T:356--></translate>
 
  
<translate>
+
===Negative numbers===
===Negative numbers=== <!--T:357--></translate>
+
If you start a cell on a new line with a negative number with a minus sign (or a parameter that evaluates to a negative number), your table can get broken, because the characters <code>|-</code> will be parsed as the wiki markup for table row, not table cell. To avoid this, insert a space before the value (<code>| -6</code>) or use in-line cell markup (<code>|| -6</code>).
<translate>
 
<!--T:358-->
 
If you start a cell on a new line with a negative number with a minus sign (or a parameter that evaluates to a negative number), your table can get broken, because the characters <code>|-</code> will be parsed as the wiki markup for table row, not table cell.</translate>
 
<translate>
 
<!--T:359-->
 
To avoid this, insert a space before the value (<code>| -6</code>) or use in-line cell markup (<code>|| -6</code>).</translate>
 
  
<translate>
+
===CSS vs attributes===
===CSS vs attributes=== <!--T:360--></translate>
+
Table borders specified through CSS rather than the border attribute will render incorrectly in a small subset of text browsers.
<translate>
 
<!--T:361-->
 
Table borders specified through CSS rather than the border attribute will render incorrectly in a small subset of text browsers.</translate>
 
  
<translate>
+
===Common attributes for columns, column groups and row groups===
===Common attributes for columns, column groups and row groups=== <!--T:362--></translate>
+
The MediaWiki syntax for tables currently offers no support for specifying common attributes for columns (with the HTML element <code>&lt;col /&gt;</code>), column groups (HTML element <code>&lt;colgroup&gt;...&lt;/colgroup&gt;</code>) and row groups (HTML elements <code>&lt;thead&gt;...&lt;/thead&gt;</code>, <code>&lt;tbody&gt;...&lt;/tbody&gt;<code> and <code>&lt;tfoot&gt;...&lt;/tfoot&gt;</code>). Those standard HTML elements are not accepted even in their HTML or XHTML syntax.
<translate>
 
<!--T:363-->
 
The MediaWiki syntax for tables currently offers no support for specifying common attributes for columns (with the HTML element <code><nowiki><col /></nowiki></code>), column groups (HTML element <code><nowiki><colgroup></colgroup></nowiki></code>) and row groups (HTML elements <code><nowiki><thead></thead></nowiki></code>, <code><nowiki><tbody></tbody></nowiki><code> and <code><nowiki><tfoot></tfoot></nowiki></code>).</translate>
 
<translate>
 
<!--T:364-->
 
Those standard HTML elements are not accepted even in their HTML or XHTML syntax.</translate>
 
  
<translate>
+
All the rows and cells (header or data) of the table are rendered within a single implicit row group (HTML element <code>&lt;tbody&gt;...&lt;/tbody&gt;</code>) without any attributes or styles.
<!--T:365-->
 
All the rows and cells (header or data) of the table are rendered within a single implicit row group (HTML element <code><nowiki><tbody></tbody></nowiki></code>) without any attributes or styles.</translate>
 
  
<translate>
+
==See also==
==See also== <!--T:366--></translate>
+
* [[Help:Sorting]]
<translate>
 
<!--T:367-->
 
* [[Special:MyLanguage/Help:Sorting#Sorting rows of a table|Sorting rows of a table]]
 
</translate>
 
 
* {{mediawiki|meta:Help:Sorting}}
 
* {{mediawiki|meta:Help:Sorting}}
 
* {{mediawiki|wikipedia:Help:Tables}}
 
* {{mediawiki|wikipedia:Help:Tables}}
<translate>
 
<!--T:370-->
 
* [http://www.tablesgenerator.com/mediawiki_tables Easy tool that helps generating tables]</translate>
 
<translate>
 
<!--T:371-->
 
* {{mediawiki|wikipedia:Template:Horizontal TOC}}. Good for country lists in table format.</translate>
 
 
<translate>
 
==Notes== <!--T:372-->
 
</translate>
 
 
<references/>
 
  
[[Category:Help{{#translation:}}|Tables]]
+
{{Languages}}
 +
[[Category:Help|Tables]]

ひつじ小屋別館2代目への投稿はすべて、他の投稿者によって編集、変更、除去される場合があります。 自分が書いたものが他の人に容赦なく編集されるのを望まない場合は、ここに投稿しないでください。
また、投稿するのは、自分で書いたものか、パブリック ドメインまたはそれに類するフリーな資料からの複製であることを約束してください(詳細はひつじ小屋別館2代目:著作権を参照)。 著作権保護されている作品は、許諾なしに投稿しないでください!

このページを編集するには、下記の確認用の質問に回答してください (詳細):

取り消し | 編集の仕方 (新しいウィンドウで開きます)