Tables on CCM - Tips

0 9

Last updated on by noctambule28
.

Here's how to make a table in the faq and the CCM files:

The syntax

To create a table

To color the texts:

For the cell syntax:

Attribute layout

The different attributes are placed side by side without space:

bold, top, right on red background is written:

|! align = "right" valign = "top" bgcolor = "# FF0000"

Then comes the cell text:

|! align = "right" valign = "top" bgcolor = "# FF0000" | cell_text

To have in addition the text in color:

|! align = "right" valign = "top" bgcolor = "# FF0000" | {{grein | cell_text}}

Simple example

Syntax:

{| 
| row1, column 1
| row 1, column 2
|-
| row 2, column 1
| row 2, column 2
|}

result:

row1, column 1row 1, column 2
row 2, column 1row 2, column 2

Syntax for frames

To position next to {|

Examples

Syntax:

{| style = "border: 2px dashed black;" width = "320"
|! Title 1
|! Title 2
|-
| align = "right" | row1, column 1
| row 1, column 2
|-
| row 2, column 1
| row 2, column 2
|}



result:

Title 1Title 2
row1, column 1row 1, column 2
row 2, column 1row 2, column 2

The syntax for alignments:

Align

Syntax:

{| 
| Positioning
|-
| align = "left" | g
|-
| align = "center" | vs
|-
| align = "right" | d
|}



result:

Valign

Syntax:

height defines the height of the cell

{| 
| height = "150" | Position
| valign = "top" | High
| valign = "middle" | Middle
| valign = "bottom" | Low
|}

result:

Examples

Syntax:

{| border = "3"
|-
|! {{blue | Title in Blue}}
|! {{red | Title in red}}
|! {{green | Title in green}}
|-
| row 1 column 1
| column 2
| column 3
|-
| line 2
| c 2
| c 3
|}

result:

Title in bold blueTitle in bold redTitle in bold green
row 1 column 1column 2column 3
l 2c 2c 3

An example of what can be done

Syntax:

{| style = "border: 5px double black;" 
| + {{red | Table title}}
|-
|! bgcolor = "# 00FF00" align = "center" | {{blue | Title in Blue}}
| align = "right" | {{red | Title in red}}
|! {{green | Title in green}}
| {{orange | title without bold}}
| {{Purple | Title column 5}}
|-
|! row 1 column 1
| bgcolor = "# FF0000" | {{black | column 2 very very wide}}
| column 3
| width = "100" align = "right" valign = "top" rowspan = "2" bgcolor = "# 00FF00" | {{white | column 4}}
| align = "right" bgcolor = "# FF0000" | column 5
|-
| {{red | line 2}}
| align = "right" | c 2
| c3
| c5 because rowspan = 2 c 4
|}

result:

Table title
Title in Blue Title in redTitle in greentitle without bold Title column 5
row 1 column 1 column 2 very very wide column 3 column 4 column 5
Online 2 c 2c3c5 because rowspan = 2 c 4

A website to help you

A website allows you to generate tables, in particular for the Wiki:

http://www.tablesgenerator.com/mediawiki_tables

There are some differences between Wikimedia and CCM, and therefore some modifications must be made in the generated Wiki code: below in red the elements to add to make it work in CCM from the code generated by the site.

(it concerns the header)


{| class = "wikitable"
|! style = "font-weight: bold;" | Tables
|! style = "text-align: center;" | Are
|! style = "text-align: right;" | Cool
|-
| col 1 is
| style = "text-align: center;" | left-aligned
| style = "text-align: right;" | $ 1600
|-
| col 2 is
| style = "text-align: center;" | centered
| style = "text-align: right;" | $ 12
|-
| col 3 is
| colspan = "2" style = "text-align: center;" | right-aligned
|}

Looks on CCM:

tables Are Cool
col 1 is left-aligned $ 1600
col 2 is centered $ 12
col 3 is right-aligned

This article appeared first on https://www.commentcamarche.net/faq/38042-les-tableaux-sur-ccm

Leave a comment

Your email address will not be published.