Aiuto:Tabelle
From Meta, a Wikimedia project coordination wiki
Questa pagina non è ancora stata tradotta dall'inglese all'italiano o la sua traduzione deve ancora essere completata. Se desideri aiutarci nella traduzione sei pregato si modificare la pagina presente su meta e poi copiala sul tuo progetto. I due collegamenti sottostanti dovrebbero puntare alla pagina in inglese su meta e alla pagina in italiano su meta.
This page has not been translated from English to Italian or its translation is not yet finished. If you want to help us in translation, please edit the Italian page on Meta and copy it to this page. The two links below should point to the English page on Meta and to the Italian page on Meta.
Questa pagina è una traduzione della corrispondente pagina del manuale in inglese di MediaWiki.
Puoi consultare (in inglese) le linee guida del manuale | la Politica editoriale
which results in <tr> Parameters can be added like this: which results in <tr params> Note:
- <tr> tags will be automatically opened at the first <td> equivalent
- <tr> tags will be automatically closed at <tr> and </table> equivalents
[edit] Cells
Cells are generated either like this:
Caption which generates <caption>Caption</caption> You can also use parameters: Caption which will generate <caption params>Caption</caption>
[edit] Displaying the table code which generates a table
The code for a simple wiki markup table inside a Code box can be seen below.
{| border="5" cellspacing="5" cellpadding="2"
| style="text-align: center;" | [[Image:gnome-system.png]]
|-
! Computer
|-
| Processor Speed: 1.8 GHz
|}
Above code produces/displays the table below:
| Cella 1 | Cella 2 | Cella 3
|- |
Cella A | Cella B | Cella C
|}
{|
|+titolo
|
Intestazione di colonna 1 | Intestazione di colonna 2 | Intestazione di colonna 3
|-
! Intestazione di riga 1
|
Cella 2 | Cella 3
|-
! Intestazione di riga A
|
Cella B | Cella C
|}
{| border="1"
|+titolo
|
Intestazione di colonna 1 | Intestazione di colonna 2 | Intestazione di colonna 3
|- |
Intestazione di riga 1 | Cella 2 | Cella 3
|- |
Intestazione di riga A | Cella B | Cella C
|} La tabella finale verrà così mostrata:
I parametri di tabella e di cella sono gli stessi dell'HTML, vedere [1] e Tabelle (HTML) anche se gli elementi Una tabella può essere utile anche se nessuna cella ha del contenuto. Per esempio, i colori di sfondo delle celle possono essere cambiato tramite i parametri di cella, rendendo la tabella una specie di diagramma, come l'm:Template talk:esempio di pentomino quadrato 8x8. Un'"immagine" in forma di tabella è molto più facile da modificare di un'immagine. Ogni riga deve avere lo stesso numero di celle delle altre, in modo da mantenere consistente il numero delle colonne nella tabella. Per le celle vuote, usare lo spazio non divisibile Con i parametri di cella colspan e rowspan le celle posso attraversare diverse righe o colonne, vedere l'esempio Mélange sottostante. Comunque, ciò ha lo svantaggio che l'ordinamento non funziona più correttamente. [edit] Esempi[edit] Esempio sempliceI due seguenti generano lo stesso risultato. Scegli lo stile più comodo in base al numero di celle in ogni riga e al testo presente in ogni cella. Marcatori wiki
Come appare nel tuo browser
[edit] Le "tabelline"Marcatori wiki
Come appare nel tuo browser (vedere: Help:User_style)
[edit] Colore; ambito dei parametriI seguenti sono due modi per specificare il colore del testo e dello sfondo per una cella singole. La prima forma è la preferita: Marcatori wiki
Come appare nel tuo browser
Come gli altri parametri i colori possono essere specificati anche per l'intera riga o per l'intera tabella; i parametri di riga hanno priorità rispetto a quelli della tabella e quelli della cella rispetto a quelli di riga: Marcatori wiki
Come appare nel tuo browser
Per fare in modo che una tabella sia sfumata nello sfondo, usare Vedere : style, background, list of colors, web colors [edit] Larghezza, altezzaÈ possibile specificare la larghezza e l'altezza di un'intera tabella, così come l'altezza di un'intera riga. Per specificare la larghezza di una colonna basta specificare la larghezza di una qualsiasi cella presente in essa. Se la larghezza non viene specificata per nessuna colonna, e/o l'altezza non viene specificata in nessuna riga, il risultato dipende dal browser. Marcatori wiki
Come appare nel tuo browser
Notare che [edit] Setting your column widthsIf you wish to force column widths to your own requirements, rather than accepting the width of the widest text element in a column's cells, then follow this example. Note that wrap-around of text is forced.
To set column widths in a table without headers, specify the width in the first cell for each column, like this:
[edit] Vertical alignmentBy default data in tables is vertically centrally aligned, which results in odd-looking layouts like this:
To fix this, apply the valign="top" attribute to the rows (unfortunately it seems to be necessary to apply this individually to every single row). For example:
[edit] PositioningOne can position the table itself, and all contents in a row, and contents in a cell, but not with a single parameter for all contents in the table, see m:Template talk:Table demo. Do not, under any circumstances, use "float" to position a table. It will break page rendering at large font sizes. [edit] MélangeHere's a more advanced example, showing some more options available for making up tables. Note however that with colspan and rowspan sorting does not work properly anymore. You can play with these settings in your own table to see what effect they have. Not all of these techniques may be appropriate in all cases; just because you can add colored backgrounds, for example, doesn't mean it's always a good idea. Try to keep the markup in your tables relatively simple -- remember, other people are going to be editing the article too! This example should give you an idea of what is possible, though. Marcatori wiki
Come appare nel tuo browser
[edit] Floating tableMarcatori wiki
What it looks like in your browser
[edit] Nested tablesThis shows one table (in blue) nested inside another table's cell2. Nested tables must start on a new line. Marcatori wiki
|
α |
cell2 {| border="2" style="background:#ABCDEF;" <!-- The nested table must be on a new line --> |
the original table again |} Come appare nel tuo browser
[edit] Combined use of COLSPAN and ROWSPANMarcatori wiki
Come appare nel tuo browser
Note that using [edit] Centering tablesCentered tables can be achieved, but they will not "float"; that is to say, no text will appear to either side. The trick is {| style="margin: 1em auto 1em auto" Marcatori wiki
Come appare nel tuo browser
[edit] Setting parametersAt the start of a cell, add your parameter followed by a single pipe. For example width="300"| will set that cell to a width of 300 pixels. To set more than one parameter, leave a space between each one. Marcatori wiki
Come appare nel tuo browser
[edit] Decimal point alignmentA method to get columns of numbers aligned at the decimal point is as follows: Marcatori wiki
Come appare nel tuo browser
If the column of numbers appears in a table with cell padding or cell spacing, one can still align the decimal points without an unsightly gap in the middle. Embed a table in each number's cell and specify its column widths. Make the embedded tables' column widths the same for each cell in the column. (If decimal points are still misaligned using this method, the main table's column may be too narrow. Add a parameter to increase the column's width.) Marcatori wiki
Come appare nel tuo browser
In simple cases one can dispense with the table feature and simply start the lines with a space, and put spaces to position the numbers: 432.1 43.21 4.321 [edit] Style classes
In the first line of table code, after the "{|", instead of specifying a style directly one can also specify a CSS class. The style for this class can be specified in various ways:
Instead of remembering table parameters, you just include an appropriate style class after the
simply by replacing inline CSS for the table by Wiki markup
What it looks like in your browser
Notice that the table retains the gray background of the wikitable class, and the headers are still bold and centered. But now the text formatting has been overridden by the local style statement; all of the text in the table has been made italic and 120% normal size, and the wikitable border has been replaced by the red dashed border. Of course this works only for browsers supporting inline CSS, if it's important use XHTML markup like [edit] SortingTables can be made sortable, see Help:Sorting. Since this can be very useful, it is wise to keep the possibilities and limitations of this feature in mind when designing a table. For example:
A long form of abbreviated content can be put as legend outside the table. [edit] Row templateRegardless of whether wikitable format or HTML is used, the wikitext of the rows within a table, and sometimes even within a collection of tables, has much in common, e.g.:
In that case it can be useful to create a template that produces the syntax for a table row, with the data as parameters. This can have many advantages:
Example: Using Help:table/example row template (talk, backlinks, edit)
{| class="wikitable sortable"
|-
! a
! b
! a/b
{{help:table/example row template| 50|200}}
{{help:table/example row template| 8| 11}}
{{help:table/example row template|1000| 81}}
|}
gives:
[edit] Table row depending on a template parameterWiki-syntax for a table row can be made optional using ParserFunctions. To avoid confusion between pipe characters as used in ParserFunctions, and those which are part of the table syntax, the latter are put with a special template:! ( talk edit history links ), see template:Table example with optional row ( talk edit history links ). [edit] Other table syntaxOther types of table syntax that MediaWiki supports:
All three are supported by MediaWiki and create (currently) valid HTML output, but the pipe syntax is the simplest, especially for people who are already familiar with HTML. Also, HTML and wiki <td> syntax will not necessarily remain browser-supported in the upcoming future, especially on handheld internet-accessible devices. See also Table (HTML), HTML element#Tables. Note however that the [edit] Comparison of table syntax
See also Template talk:For#Tables. [edit] Pipe syntax in terms of the HTML producedThe pipe syntax, developed by Magnus Manske, substitutes pipes (|) for HTML. There is an on-line script which converts html tables to pipe syntax tables. The pipes must start at the beginning of a new line, except when separating parameters from content or when using [edit] TablesA table is defined by {| ''params'' |} which equals <table ''params''>Insert non-formatted text here </table>
[edit] Rows<tr> tags will be generated automatically for the first row. To start a new row, use |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| cell1 | cell2 | cell3
or like this: |
cell1 | cell2 | cell3
which both equal <td>cell1</td><td>cell2</td><td>cell3</td> so "||" equals "newline" + "|" Parameters in cells can be used like this: |
cell1 | cell2 | cell3
which will result in <td params>cell1</td> <td params>cell2</td> <td params>cell3</td> [edit] HeadersFunctions the same way as TD, except "!" is used instead of the opening "|". "!!" can be used instead of "||". Parameters still use "|", though! Example: !params|cell1 [edit] CaptionsA <caption> tag is created by |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Computer | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Processor Speed: 1.8 GHz | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Below code, generated and displayed the above table's Code box code itself, on the screen and web page, inside a blue colored dashed bordered rectangular box.
<pre>
{| border="5" cellspacing="5" cellpadding="2"
| style="text-align: center;" | [[Image:gnome-system.png]]
|-
! Computer
|-
| Processor Speed: 1.8 GHz
|}
</pre>
|
Note that, HTML tag <pre> was used to achieve displaying the above codes and the Code box.
[edit] Other alternatives to display table code
In most cases, when a code line is longer than the web browser window's width, then a scrolling bar appears at bottom, to let the viewer slide to the right side (and also left side) to see the rest of the codes, because, the use of <pre> tag causes the code line to remain intact, unless an EOL (CR/LF) hidden character is reached in that text line. But having to slide or scroll to the right or left for viewing the full codes is often not comfortable to many readers. To solve such problem, using the <p>, <tt> and <br /> HTML tags, are better than using the <pre> tag, as those will limit the length of a line of code according the available space in the web browser's window and therefor will not result in the need to move the scroll-bar right (or left) for viewing. By placing the codes inside the <tt>...</tt> HTML tags, codes are displayed with a fixed width text/font, (like the <pre> tag uses) for easier reading. HTML tag <br /> is used to display (or bring) next line of codes, starting from the next line. HTML tag <p> along with its CSS style properties, is used to create the blue colored dashed bordered rectangular box (Code box) around the codes, (like the HTML <pre> tag, which gets these properties from the main.css stylesheet file).
An example of table code with a long line is:
{| border="5" cellspacing="5" cellpadding="2"
| style="text-align: center;" | [[Image:gnome-system.png]]
|-
! Computer
|-
| style="color: yellow; background-color: green;" | Processor Speed: <span style="color: white;"> 1.8 GHz </span>
|}
producing the below table:
| Computer |
|---|
| Processor Speed: 1.8 GHz |
Code box above the table has the auto line wrapping feature enabled. Note the long line (the sixth line from top) inside the codes, which is wrapped inside the Code box. This Code box and the codes, can be displayed by using below codes in the edit box.
<p style="padding: 1em; border: 1px dashed #2f6fab; color: Black; background-color: #f9f9f9; line-height: 1.1em;"> <tt>
<nowiki>{|</nowiki> border="5" cellspacing="5" cellpadding="2" <br />
| style="color: yellow; background-color: green;" | Processor Speed: <nowiki><span style="color: white;"></nowiki> 1.8 GHz <nowiki></span></nowiki> <br />
<nowiki>|}</nowiki> <br />
</tt> </p>
See the above codes, note that, <nowiki>...</nowiki> tags were used to disable wiki markup codes for beginning a table ({|), ending a table (|}), start of an image displaying ([[), or a hyperlink, etc. All wiki & HTML markup codes need to be disabled by enclosing them inside the <nowiki>...</nowiki> tags. If these codes were to be displayed inside another table, then, each | (pipe) & ! (Exclamation mark) symbol also needed to be enclosed inside the <nowiki> tags. Note that, the longer line is automatically wrapped according to the width of the web browser's window, inside the Code box.
Alternatively, we can replace each | (pipe symbol) character with | (HTML decimal entity code), replace each ! (exclamation mark) with ! code, replace { (beginning curly/second bracket) with { and we may replace } (closing curly/second bracket) with } code. Also replace the < (less than sign, or beginning angle bracket) with < numeric entity code or, replace it with < (HTML symbol entity code). For more on HTML decimal or hexadecimal numeric entity codes, please see w:Windows Alt codes. To display the wiki image markup code, we should replace the [ (beginning square/third bracket) with [ and we may replace ] (closing square/third bracket) with ]. When we are replacing characters with their numeric enitity codes, we are actually disabling their normal functionality, so we can display them on the web page(s).
<p style="padding: 1em; border: 1px dashed #2f6fab; color: Black; background-color: #f9f9f9; line-height: 1.1em;"> <tt>
{| border="5" cellspacing="5" cellpadding="2" <br />
| style="text-align: center;" | [[Image:gnome-system.png]] <br />
|- <br />
! Computer <br />
|- <br />
| style="color: yellow; background-color: green;" | Processor Speed: <span style="color: red;"> 1.8 GHz </span> <br />
|} <br />
</tt> </p>
See also disabling wikitext interpretation and/or reformatting.
[edit] See also
- m:simplified table syntax
- m:wiki markup tables
- w:en:User:Dcljr/Tables
- w:Table (HTML)
- Help:Template#A_parameter_value_containing_a_pipe_character
- examples:
[edit] External links
- de:Wikipedia:Helferlein/VBA-Macro for EXCEL tableconversion published in German-Wikipediaproject (english instructions included)
- HTML tables to wiki converter at cnic.org
- csv2wp - converts comma-separated values (CSV) format to pipe syntax. You may use this to import tables from Excel etc. (more information)
- HTML tables to wiki converter at uni-bonn.de
- HTML tables to wiki converter at diberri.dyndns.org
- pywikipediabot (can convert HTML tables to wiki)
| Sommario delle pagine di Aiuto - Pagine nel namespace Aiuto su: Meta b: n: w: q: wiktionary Per i lettori: Vai | Ricerche | URL | Namespace | Nomi delle pagine | Sezioni | Collegamenti | Puntano qui | Piped link | Collegamenti Interwiki | Reindirizzamenti | Variabili | Categorie | Pagine speciali |
Questa pagina è una traduzione della corrispondente pagina del manuale in inglese di MediaWiki.
Puoi consultare (in inglese) le linee guida del manuale | la Politica editoriale
| Sommario delle pagine di Aiuto - Pagine nel namespace Aiuto su: Meta b: n: w: q: wiktionary Per i lettori: Vai | Ricerche | URL | Namespace | Nomi delle pagine | Sezioni | Collegamenti | Puntano qui | Piped link | Collegamenti Interwiki | Reindirizzamenti | Variabili | Categorie | Pagine speciali |
